On Saturday, July 16, 2016 at 1:28:32 AM UTC+8, Evan Digby wrote: > > I can't reproduce this in go playground (yet), but under what > circumstances would/could/should: > > nss := []namespace.Namespace{ > append(ns, g2message.NamespaceWin...), > append(ns, g2message.NamespaceSpend...), > } > > Act differently than: > > ns1 := append(ns, g2message.NamespaceWin...) > ns2 := append(ns, g2message.NamespaceSpend...) > > nss := []namespace.Namespace{ > ns1, > ns2, > } > > ns is a parameter on the function (actually, it's a parameter on the > function that generated the function that is being called, and ns is a > closure), and is currently: > > namespace.New("localhost") > > The definitions in the "namespace" and "g2message" packages are: > > type Namespace []string > > var NamespaceWin namespace.New("win") // New is making Namespace{"win"} > var NamespaceSpend namespace.New("spend") > > I would think under no circumstances; however, that's not my experience. > > Result of fmt.Println(nss) on the first example (expected): > > [[localhost win] [localhost spend]] > > Result of fmt.Println(nss) on the second example: > > [[localhost spend] [localhost spend]] >
I can't reproduce it also. Can I confirm the input ns is totally the same for the two callings? > > It's not running in a loop, separate goroutine, or anything. Those lines > are all that change between the two results. I'm at a loss. I will keep > trying to reproduce in go playground. > > > Thanks, > > > Evan > -- 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.