aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2024-01-25 04:18:36 +0700
committerShulhan <m.shulhan@gmail.com>2026-04-14 21:51:40 +0700
commit7ace40ec22f23a9df78fdbee54fc44e6e30fb1dc (patch)
tree31b57ce6b9a575c4f9318e375d4f4ac402ec8e86 /src/encoding/json/decode.go
parent4f51d4c33231636f46d44f996cf4c6822dd2ee19 (diff)
downloadgo-7ace40ec22f23a9df78fdbee54fc44e6e30fb1dc.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.go10
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
}