Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/gob: data missing while encoding an empty *string #22287

Closed
xtudouh opened this issue Oct 16, 2017 · 2 comments
Closed

encoding/gob: data missing while encoding an empty *string #22287

xtudouh opened this issue Oct 16, 2017 · 2 comments

Comments

@xtudouh
Copy link

@xtudouh xtudouh commented Oct 16, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.8.3

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

https://play.golang.org/p/3akEQ76r55

What did you expect to see?

dest.B should be ""

What did you see instead?

nil

@cznic
Copy link
Contributor

@cznic cznic commented Oct 16, 2017

Basics

... Pointers are not transmitted, but the things they point to are transmitted; that is, the values are flattened. ...

Encoding Details

... If a field has the zero value for its type (except for arrays; see above), it is omitted from the transmission. ...

It is working as intended/documented. (*string -> string, string == "" -> not encoded.)

@gbbr gbbr changed the title Data missing while use encoding/gob encoding an empty *string encoding/gob: data missing while encoding an empty *string Oct 16, 2017
@gbbr
Copy link
Member

@gbbr gbbr commented Oct 16, 2017

Seems like @cznic is right, this is working as intended. Closing.

@gbbr gbbr closed this Oct 16, 2017
@golang golang locked and limited conversation to collaborators Oct 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.