File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ import (
16
16
// The function errors if the data in b does not match the type of v.
17
17
//
18
18
// The function panics if v cannot be converted to a thrift representation.
19
+ //
20
+ // As an optimization, the value passed in v may be reused across multiple calls
21
+ // to Unmarshal, allowing the function to reuse objects referenced by pointer
22
+ // fields of struct values. When reusing objects, the application is responsible
23
+ // for resetting the state of v before calling Unmarshal again.
19
24
func Unmarshal (p Protocol , b []byte , v interface {}) error {
20
25
br := bytes .NewReader (b )
21
26
pr := p .NewReader (br )
@@ -347,7 +352,6 @@ type structDecoder struct {
347
352
}
348
353
349
354
func (dec * structDecoder ) decode (r Reader , v reflect.Value , flags flags ) error {
350
- v .Set (dec .zero )
351
355
flags = flags .only (decodeFlags )
352
356
coalesceBoolFields := flags .have (coalesceBoolFields )
353
357
You can’t perform that action at this time.
0 commit comments