Skip to content

encoding/json: SyntaxError message change breaks brittle tests #42675

Closed
@dsnet

Description

@dsnet

The change for #36221 adds a json: prefix to SyntaxError, which breaks >50 targets for the regression tests we run inside Google.

Thoughts:

  • Relying on the error message is to rely on unspecified behavior and is generally considered outside the Go 1 compatibility promise. The json package theoretically has the right to change error messages.
  • At the same time 50 targets is a non-trivial number of breakages. Fortunately they are all test failures (from my high-level glance).
  • If we're going to cause churn with a changed error message, should we also consider whether SyntaxError.Offset should be part of the error message string? Why or why not?
  • Should we batch changes like this for the future where we may want to introduce other changes to 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions