diff options
| author | Shulhan <m.shulhan@gmail.com> | 2024-01-25 04:18:36 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-02-03 18:04:30 +0700 |
| commit | c9f30d6b1840f109b2009fbf3081a97659e0927c (patch) | |
| tree | bbcab1d9497b84ec8185a865b59cc04ab3858201 /src/encoding/json/decode.go | |
| parent | a145075005e7f3ead28ff8a517728c4a8a14fa0c (diff) | |
| download | go-c9f30d6b1840f109b2009fbf3081a97659e0927c.tar.xz | |
encoding/json: realign struct UnmarshalTypeError and decodeState
This reduce the UnmarshalTypeError size from 64 to 56 bytes (-8 bytes),
and decodeState from 128 to 96 (-32 bytes).
Diffstat (limited to 'src/encoding/json/decode.go')
| -rw-r--r-- | src/encoding/json/decode.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go index 59d4c7e734..c33b0ada8a 100644 --- a/src/encoding/json/decode.go +++ b/src/encoding/json/decode.go @@ -124,11 +124,11 @@ type Unmarshaler interface { // An UnmarshalTypeError describes a JSON value that was // not appropriate for a value of a specific Go type. type UnmarshalTypeError struct { - Value string // description of JSON value - "bool", "array", "number -5" Type reflect.Type // type of Go value it could not be assigned to - Offset int64 // error occurred after reading Offset bytes + Value string // description of JSON value - "bool", "array", "number -5" Struct string // name of the struct type containing the field Field string // the full path from root node to the field, include embedded struct + Offset int64 // error occurred after reading Offset bytes } func (e *UnmarshalTypeError) Error() string { @@ -210,12 +210,12 @@ type errorContext struct { // decodeState represents the state while decoding a JSON value. type decodeState struct { + scan scanner + savedError error + errorContext *errorContext data []byte off int // next read offset in data opcode int // last read result - scan scanner - errorContext *errorContext - savedError error useNumber bool disallowUnknownFields bool } |
