One other use for := that I have seen (although I'm not necessarily a fan 
of this use) is to allow a function in a package to return a non-exported 
typed object.

E.g.

--------
package foo

type hidden struct {...}

func FooProduce() *hidden {...}
func FooConsume(h *hidden){...}

----------
package main

....
x := FooProduce()
FooConsume(x)

-----------

There's no way to declare x without exporting its type. (Ignore the 
simplistic case that could be reduced to FooConsume(FooProduce()) - there 
are other reasons to store and pass around opaque types)

-- 
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.

Reply via email to