We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If the writer encounters an error the error is stored in the encoder, but it is not returned.
encoding/json/json.go
Line 537 in 3055897
This is because the above line is creating a new err variable due to the : in the assignment.
:
This test code demonstrates the issue:
type errWriter struct{} func (ew *errWriter) Write([]byte) (n int, err error) { return 0, errors.New("test-error") } func TestWriterErr(t *testing.T) { t.Parallel() enc := NewEncoder(&errWriter{}) err := enc.Encode("") if err == nil { t.Error("expected error not returned") } else if err.Error() != "test-error" { t.Errorf("unexpected error returned: want=test-error got=%s", err.Error()) } }
The text was updated successfully, but these errors were encountered:
fix: return error from the underlying writer. Fixes segmentio#139
09fc996
4b488cc
5d3c3f9
No branches or pull requests
If the writer encounters an error the error is stored in the encoder, but it is not returned.
encoding/json/json.go
Line 537 in 3055897
This is because the above line is creating a new err variable due to the
:
in the assignment.This test code demonstrates the issue:
The text was updated successfully, but these errors were encountered: