-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: panics encoding nil pointer - reopen #31664
Comments
Solved by additional implementaiton of check. Still enc.Encode() should return error and not panic.
|
And the diff:
|
/cc @robpike |
CR requested via Gerrit https://go-review.googlesource.com/c/go/+/173781 @robpike @bradfitz |
Change https://golang.org/cl/173781 mentions this issue: |
Hi, any updates? |
Change https://go.dev/cl/554415 mentions this issue: |
This isssue is related to #3704 (cannot be reopened)
Currently encoding/gob panics if it is not able to do something. It's incorrect as this cannot be caught and supported on code level to provide "workaround" or failsafe activity to recover.
I'm not convinced by "that's the way it should react" in response of related message.
The code:
As you see I don't care about panic here. It can be empty in my case.
This error could be supported on code level if it's catchable - in my context for example I can skip object that has nil pointer because it will not be deserialized back.
Platform details:
Go version: 1.12
GOOS = linux
GOARCH = amd64
I would expect to have error returned so it will be caught and workaround could be done.
The text was updated successfully, but these errors were encountered: