MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / decodeStdlib

Function decodeStdlib

libs/json/decoder.go:258–273  ·  view source on GitHub ↗
(bz []byte, rv reflect.Value)

Source from the content-addressed store, hash-verified

256}
257
258func decodeStdlib(bz []byte, rv reflect.Value) error {
259 if !rv.CanAddr() && rv.Kind() != reflect.Ptr {
260 return errors.New("value must be addressable or pointer")
261 }
262
263 // Make sure we are unmarshaling into a pointer.
264 target := rv
265 if rv.Kind() != reflect.Ptr {
266 target = reflect.New(rv.Type())
267 }
268 if err := json.Unmarshal(bz, target.Interface()); err != nil {
269 return err
270 }
271 rv.Set(target.Elem())
272 return nil
273}
274
275type interfaceWrapper struct {
276 Type string `json:"type"`

Callers 2

decodeReflectFunction · 0.85
decodeReflectListFunction · 0.85

Calls 3

TypeMethod · 0.65
SetMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected