3 ms·
Well, the second arg of Unmarshall is expected to be some kind of pointer. > Unmarshal parses the JSON-encoded data and stores the result in the value pointed
by ttctciyf 7y ago
Well, the second arg of Unmarshall is expected to be some kind of pointer.
> Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.[1]
In (1) the '&' in '&thing' means roughly "the address of", so you are passing "the address of thing" i.e. a Thing pointer that points to the thing variable.
1: https://golang.org/src/encoding/json/decode.go https://golang.org/src/encoding/json/decode.go