Re:Gopher Tricks
by PuerkitoBio on Friday August 21, 2015 @03:23PM
(#10099684)
I use them extensively for test cases (`cases := []struct{...} { ... }`) as mentioned in the slides. Also sometimes to marshal/unmarshal one-off json or xml payloads.
It'd be nice to have a shorthand which mixed the type definition and assignment into a single line so you could do something like:
S := { x int : 1, y int : 2 }
Or even
S:= { x := 1, y := 2 }