From b9108a38f00ea2543ffe88b548206239583870a2 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Wed, 3 Jul 2024 15:59:52 -0500 Subject: [PATCH] Fix misuses of json.RawMessage --- jsonx/json.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonx/json.go b/jsonx/json.go index 5828142..9ec7056 100644 --- a/jsonx/json.go +++ b/jsonx/json.go @@ -57,12 +57,12 @@ func marshal(v any, indent string) ([]byte, error) { } // Unmarshal is just a shortcut for json.Unmarshal so all calls can be made via the jsonx package -func Unmarshal(data json.RawMessage, v any) error { +func Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v) } // UnmarshalArray unmarshals an array of objects from the given JSON -func UnmarshalArray(data json.RawMessage) ([]json.RawMessage, error) { +func UnmarshalArray(data []byte) ([]json.RawMessage, error) { var items []json.RawMessage err := Unmarshal(data, &items) return items, err @@ -81,7 +81,7 @@ func UnmarshalWithLimit(reader io.ReadCloser, s any, limit int64) error { } // MustUnmarshal unmarshals the given JSON, panicking on an error -func MustUnmarshal(data json.RawMessage, v any) { +func MustUnmarshal(data []byte, v any) { if err := json.Unmarshal(data, v); err != nil { panic(err) }