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

Comments

Projects
None yet
2 participants
@ibukanov

ibukanov commented Jul 24, 2015

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.

@mikioh mikioh changed the title from UnmarshalTypeError.Offset and json subparsers to encoding/json: UnmarshalTypeError.Offset and json subparsers Jul 24, 2015

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jul 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment