Skip to content

Commit 8176ac1

Browse files
committed
optimise CPU and memory usage
1 parent f0c74ae commit 8176ac1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

binary.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,13 @@ func (c *codec) newOperation(iface interface{}) (
153153
return
154154
}
155155

156-
operation.formatName = reflection.String()
157-
158156
operation.valueReflection = reflect.ValueOf(iface).Elem()
159157

160158
return
161159
}
162160

163161
type codecOperation struct {
164162
format *formatMetadata
165-
formatName string
166163
valueReflection reflect.Value
167164
}
168165

@@ -179,7 +176,9 @@ func (c *codecOperation) unmarshal(bytes []byte) (e error) {
179176
uint(len(bytes)),
180177
)
181178

182-
e.(validation.FormatError).SetFormatName(c.formatName)
179+
e.(validation.FormatError).SetFormatName(
180+
c.valueReflection.Type().String(),
181+
)
183182

184183
return
185184
}

0 commit comments

Comments
 (0)