Skip to content
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: UnmarshalTypeError.Offset and json subparsers #11858

Open
ibukanov opened this issue Jul 24, 2015 · 0 comments
Open

encoding/json: UnmarshalTypeError.Offset and json subparsers #11858

ibukanov opened this issue Jul 24, 2015 · 0 comments
Milestone

Comments

@ibukanov
Copy link

This is a followup to #9693 that added UnmarshalTypeError.Offset to record textual position of errors during unmarshaling. The problem with the landed patch is that it does not deal with UnmarshalTypeError returned from implementations of Unmarshaler.UnmarshalJSON(). The offset in such case would reflect an offset from the beginning of the slice, not from the start of the original JSON.

It would be nice to be able to recover the full offset for such cases. For example, UnmarshalTypeError could include a boolean flag indicating that UnmarshalTypeError.Offset should be updated by the caller to reflect the real position in the file. Then the code that handles errors from UnmarshalJSON would do just that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants