On Fri, 21 Oct 2016 09:49:24 -0700 (PDT) Nate Finch <nate.fi...@gmail.com> wrote:
> One of the problems with working with serialization of any kind is > dealing with unset vs the zero value. The usual way to get around > this is to use a pointer, nil is unset, non-nil is set. But this > gets annoying when trying to make literal values, because you can't > take the address of a constant: > > type Foo struct { > Count *int > } > f := Foo{ Count: &5 } > > // cannot take the address of 5 See also the recent thread (14 Oct) on the same topic: https://groups.google.com/d/topic/golang-nuts/NR_oWflin-Q/discussion [...] -- 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.