-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/json: SyntaxError message change breaks brittle tests #42675
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
Comments
I agree. Do we have more suggestions, though?
That could be a good idea, but how would you render it in the string? If you use Another reason not to do it is that, right now,
At this point I've learned to not try to argue with test breakages :) |
Yikes. I did try to search on Github for code snippets that this change could break, but that search wasn't exhaustive and probably Google writes better tests. I think backing this change out is the right thing to do. |
To be clear, these tests are brittle and shouldn't depend on the exact text of stdlib errors. We're fine with dealing with it internally. However, 50 tests is more than we usually see break from a changed error message, which might point at this having more impact than expected in the ecosystem at large. |
Change https://golang.org/cl/273747 mentions this issue: |
Looking at things like the mod_proxy_invalid.txt message, I think leaving the prefix out makes a lot of sense. Let's just revert it please. What's done is done. |
A bigger discussion, I guess, but if it doesn't make sense to prepend the package name prefix in this case, I'm wondering why we have this convention in the standard library at all. I've noticed it's funky to expose Go errors to frontend clients in a browser UI context. |
@kevinburke, yes, in general I think that rule is clearly not something to apply 100% of the time. io.EOF is "EOF" not "io: EOF". And os.Open("nonexist") returns an error that says "open nonexist: file does not exist", not "os: open nonexist: syscall: file does not exist". |
@rsc, I would expect it to be consistent within a package, though. All other errors within the |
The change for #36221 adds a
json:
prefix toSyntaxError
, which breaks >50 targets for the regression tests we run inside Google.Thoughts:
json
package theoretically has the right to change error messages.SyntaxError.Offset
should be part of the error message string? Why or why not?json
that are technically compliant with the Go 1 compatibility promise, but may be slightly disruptive? Presumably it's better to break brittle targets once, rather than repeatedly.Filing this issue to decide whether we're sure we want to move forward with this change.
\cc @mvdan @kevinburke @rsc
The text was updated successfully, but these errors were encountered: