encoding/json: clarify Decoder.InputOffset semantics #42571
Labels
Documentation
Issues describing a change to documentation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The documentation on
Decoder.InputOffset
currently says:This explanation is somewhat incorrect since the offset cannot be a single value if there are intervening whitespace in-between two JSON tokens. Furthermore, the
json
package implicitly handles colons and commas, which are technically JSON tokens according to RFC 7159, section 2. May the offset ever be past these implicit colons and commas, or will it always be before them? The "token" in this context is a somewhat ambiguous.The documentation should be clarified to say one of the following:
I chose the phrase "may be returned" to indicate that colons and commas aren't included since they aren't ever returned by the
json
API. I haven't checked the implementation yet to see what it actually returns.The first definition gives more flexibility to how the
Decoder
may actually be implemented. The latter two definitions gives the user more assurance about whatInputOffset
actually means.Updates #29688
The text was updated successfully, but these errors were encountered: