Gob does not encode pointers as different from values. The stream is a
stream of values. How many indirections it takes the values to come to
the stream is not recorded. A consequence of that, combined with not
sending zero values, is that empty strings and nil pointers to strings
are encoded the same. In fact they are not encoded at all.


-rob

On Thu, Dec 2, 2021 at 7:22 AM 'Robert Whitcher' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> https://go.dev/play/p/bZtT0XdqmRg.go?download=true
>
> Seems like it is impossible to differentiate between not set and set to empty 
> string which seem like different cases to me.
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/fde8754f-f381-4d90-ab04-248f45e69f8dn%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOXNBZQqC6sRTKf99%2Bh_S7aBMt7dqen7OexTCf%3DJ%3DcCsJzFUEg%40mail.gmail.com.

Reply via email to