diff options
Diffstat (limited to 'decode.go')
-rw-r--r-- | decode.go | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -103,14 +103,6 @@ func (dec *Decoder) stackName() string { return strings.Join(fields, ".") } -func Decode(r io.RuneScanner, ptr any) error { - return NewDecoder(r).Decode(ptr) -} - -func DecodeThenEOF(r io.RuneScanner, ptr any) error { - return NewDecoder(r).DecodeThenEOF(ptr) -} - // DecodeThenEOF is like decode, but emits an error if there is extra // data after the JSON. func (dec *Decoder) DecodeThenEOF(ptr any) (err error) { @@ -494,7 +486,7 @@ func (dec *Decoder) decode(val reflect.Value, nullOK bool) { // TODO: Figure out how to do this without buffering, have correct offsets. var buf bytes.Buffer dec.decodeString(nil, &buf) - if err := Decode(bytes.NewReader(buf.Bytes()), fVal.Addr().Interface()); err != nil { + if err := NewDecoder(bytes.NewReader(buf.Bytes())).Decode(fVal.Addr().Interface()); err != nil { if str := buf.String(); str != "null" { dec.panicType("", fVal.Type(), fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", |