You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
UnmarshalTypeError.Offset and json subparsers
encoding/json: UnmarshalTypeError.Offset and json subparsers
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.
The text was updated successfully, but these errors were encountered: