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 file identified wrongly #3355

Closed
gopherbot opened this issue Mar 19, 2012 · 2 comments
Closed

encoding/gob: data file identified wrongly #3355

gopherbot opened this issue Mar 19, 2012 · 2 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 19, 2012

by raul.san@sent.com:

When you create a file encoded to gob, it's very possible that the command
"file" misdetects it (like if it were known format).

The solution is add the header [3]byte{'g', 'o', 'b'} (it's tested and it works).

To avoid this problem, gob.NewEncoder could have an argument to insert an header, and
gob.NewDecoder to skip it.
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Mar 19, 2012

Comment 1:

If you care about this, you can add and remove your own headers.  Gob doesn't define its
own magic, though.
@robpike
Copy link
Contributor

@robpike robpike commented Mar 19, 2012

Comment 2:

Status changed to WorkingAsIntended.

@mikioh mikioh changed the title gob data file identified wrongly encoding/gob: data file identified wrongly Feb 26, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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
3 participants
You can’t perform that action at this time.