Skip to content

proposal: encoding/json/jsontext: add KindEOF #76753

@neild

Description

@neild

This is branched off of #76467, and is related to #75431.

encoding/json/jsontext.Decoder.PeekKind returns KindInvalid (0) if the next read will return an error.

I propose that PeekKind distinguish between EOF (at end of input, input is syntactically valid, no errors encountered) and errors (I/O error, syntax error, etc.). Since we've rejected PeekKind returning an error, we could do this with an additional Kind:

const (
  KindEOF Kind = 1 // returned by PeekKind at syntactically-valid EOF
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal

    Type

    No type

    Projects

    Status

    Needs review

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions