-
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/json: eof error of NewDecoder().Decode() should be same with Unmarshal() #25956
Comments
/cc @dsnet |
BTW. a solution is change go/src/encoding/json/stream.go Line 126 in c993002
|
Seems worth changing, want to send a CL? |
@ianlancetaylor - Just concerned, can it be considered a borderline breaking change ? |
@agnivade Yes, it's clearly possible to write a program that will observe this change. I'm guessing that few programs test explicitly for Actually thinking about it a bit more I'm not sure which way to change it. Is it better to always return a |
A quick github search for There might be more but I stopped searching after I got these. Both of these do |
Arguments for changing it to
That being said, I may have expected |
I support changing it to
|
@dsnet - I tried changing it to
Whereas, if I do the other way and change to But your call. Let me know. |
I know very little about
Sounds to me like the Go2 error proposals would help a bit here :) Maybe we can wrap
If it's just tests that break, and the breakage is consistent with what we're changing here, I'd just fix the tests. Unless what you mean is that unrelated tests are starting to fail. The cases you pasted do look like unexpected EOFs. |
Sure, I can fix the tests. Just needed a confirmation on whether to go ahead or not. |
I'm also hitting this, it's awkward to have to check |
Any news on this? |
I think the solution here needs to be adapted given that error wrapping is a reality, e.g. see https://golang.org/pkg/errors/#Is.
If anyone wants to work on a patch and send it, I'm happy to review it. Otherwise, I don't think anyone is actively working on this, so there won't be any news unless someone leaves a comment with an update. |
I should also clarify - such a change is too risky now that we're in the middle of the 1.14 freeze, so a CL would probably be merged once the tree reopens in roughly six weeks from now. |
Sir I'm using go1.14 var member Member // struct type |
to reflect the issue and get
Note that |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.1 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOOS="darwin"
What did you do?
https://play.golang.org/p/gr5cHhrpmbK
What did you expect to see?
shown in previous link
What did you see instead?
shown in previous link
The text was updated successfully, but these errors were encountered: