Hi,
I've the following example code of correct version.
func SomeFunction(itemPtr interface{}) {
//itemPtr must be pointer to struct and not struct.
}
func SomeFunctionCaller() {
u := UserRecord{}
SomeFunction(&u)
}
Above is the correct version, but some coders pass struct instead of
pointer which causes run-time errors.
Bad version:
func SomeFunctionCaller() {
u := UserRecord{}
SomeFunction(u)
}
Is there a way to force "SomeFunction" to take pointers only at compile
time?
Thanks and best regards,
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.