Even more surprising, make this small change to the previous playground link code:
func (t *T) CopyExplicitDeref() *T { x := *t return &x } Merely introducing a local variable changes the behavior of the method. On Wednesday, March 28, 2018 at 6:21:49 PM UTC+2, thwd wrote: > > https://play.golang.org/p/pjyoPX99Zr1 > > Taking the address of an explicit dereference has different behavior than > implicitly dereferencing and taking address. > > Is this the desired behavior? It surprised me. > -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.