MCPcopy
hub / github.com/protocolbuffers/protobuf-go / Peek

Method Peek

internal/encoding/json/decode.go:59–65  ·  view source on GitHub ↗

Peek looks ahead and returns the next token kind without advancing a read.

()

Source from the content-addressed store, hash-verified

57
58// Peek looks ahead and returns the next token kind without advancing a read.
59func (d *Decoder) Peek() (Token, error) {
60 defer func() { d.lastCall = peekCall }()
61 if d.lastCall == readCall {
62 d.lastToken, d.lastErr = d.Read()
63 }
64 return d.lastToken, d.lastErr
65}
66
67// Read returns the next JSON token.
68// It will return an error if there is no valid token.

Callers 7

TestDecoderFunction · 0.95
unmarshalListMethod · 0.45
UnmarshalFromMethod · 0.45
unmarshalAnyMethod · 0.45
unmarshalKnownValueMethod · 0.45
unmarshalMessageMethod · 0.45
unmarshalListMethod · 0.45

Calls 1

ReadMethod · 0.95

Tested by 1

TestDecoderFunction · 0.76