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 (
1616// The function errors if the data in b does not match the type of v.
1717//
1818// 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.
1924func Unmarshal (p Protocol , b []byte , v interface {}) error {
2025 br := bytes .NewReader (b )
2126 pr := p .NewReader (br )
@@ -347,7 +352,6 @@ type structDecoder struct {
347352}
348353
349354func (dec * structDecoder ) decode (r Reader , v reflect.Value , flags flags ) error {
350- v .Set (dec .zero )
351355 flags = flags .only (decodeFlags )
352356 coalesceBoolFields := flags .have (coalesceBoolFields )
353357
You can’t perform that action at this time.
0 commit comments