MCPcopy Create free account
hub / github.com/cli/cli / decodeJSON

Function decodeJSON

script/ghmock/set.go:434–445  ·  view source on GitHub ↗
(data []byte, v any)

Source from the content-addressed store, hash-verified

432}
433
434func decodeJSON(data []byte, v any) error {
435 dec := json.NewDecoder(bytes.NewReader(data))
436 dec.UseNumber()
437 if err := dec.Decode(v); err != nil {
438 return err
439 }
440 var extra any
441 if err := dec.Decode(&extra); err != io.EOF {
442 return fmt.Errorf("unexpected data after the JSON value")
443 }
444 return nil
445}
446
447func jsonKind(v any) string {
448 switch v.(type) {

Callers 2

setAtPathFunction · 0.70
decodeBodyFunction · 0.70

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected