diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2025-10-28 15:23:47 -0700 |
|---|---|---|
| committer | Joe Tsai <joetsai@digital-static.net> | 2025-11-05 15:51:03 -0800 |
| commit | c299a96624e7b9c1667084361b79a0e0b132993a (patch) | |
| tree | 029bb026ebb94082eb3827bc4df845719e1b2e96 /types | |
| parent | 77123a569ba1055f091db06e2d1b59c09b02f108 (diff) | |
| download | tailscale-dsnet/jsonimports-ci.tar.xz tailscale-dsnet/jsonimports-ci.zip | |
all: apply consistent imports of "json" packagesdsnet/jsonimports-ci
This runs:
go run ./cmd/jsonimports -update -ignore=tempfork/
which applies the following rules:
* Until the Go standard library formally accepts "encoding/json/v2"
and "encoding/json/jsontext" into the standard library
(i.e., they are no longer considered experimental),
we forbid any code from directly importing those packages.
Go code should instead import "github.com/go-json-experiment/json"
and "github.com/go-json-experiment/json/jsontext".
The latter packages contain aliases to the standard library
if built on Go 1.25 with the goexperiment.jsonv2 tag specified.
* Imports of "encoding/json" or "github.com/go-json-experiment/json/v1"
must be explicitly imported under the package name "jsonv1".
If both packages need to be imported, then
the former should be imported under the package name "jsonv1std".
* Imports of "github.com/go-json-experiment/json"
must be explicitly imported under the package name "jsonv2".
The latter two rules exist to provide clarity when reading code.
Without them, it is unclear whether "json.Marshal" refers to v1 or v2.
With them, however, it is clear that "jsonv1.Marshal" is calling v1 and
that "jsonv2.Marshal" is calling v2.
Updates tailscale/corp#791
Signed-off-by: Joe Tsai <joetsai@digital-static.net>
Diffstat (limited to 'types')
| -rw-r--r-- | types/appctype/appconnector_test.go | 10 | ||||
| -rw-r--r-- | types/ipproto/ipproto_test.go | 6 | ||||
| -rw-r--r-- | types/jsonx/json.go | 8 | ||||
| -rw-r--r-- | types/jsonx/json_test.go | 16 | ||||
| -rw-r--r-- | types/key/control.go | 6 | ||||
| -rw-r--r-- | types/key/control_test.go | 6 | ||||
| -rw-r--r-- | types/key/derp.go | 6 | ||||
| -rw-r--r-- | types/key/disco_test.go | 8 | ||||
| -rw-r--r-- | types/key/hardware_attestation.go | 6 | ||||
| -rw-r--r-- | types/key/machine_test.go | 8 | ||||
| -rw-r--r-- | types/key/node_test.go | 8 | ||||
| -rw-r--r-- | types/logger/logger.go | 8 | ||||
| -rw-r--r-- | types/netlogtype/netlogtype_test.go | 4 | ||||
| -rw-r--r-- | types/netmap/netmap.go | 4 | ||||
| -rw-r--r-- | types/opt/bool_test.go | 8 | ||||
| -rw-r--r-- | types/opt/value_test.go | 8 | ||||
| -rw-r--r-- | types/prefs/prefs_test.go | 6 | ||||
| -rw-r--r-- | types/tkatype/tkatype_test.go | 6 |
18 files changed, 66 insertions, 66 deletions
diff --git a/types/appctype/appconnector_test.go b/types/appctype/appconnector_test.go index 390d1776a..4bafef46d 100644 --- a/types/appctype/appconnector_test.go +++ b/types/appctype/appconnector_test.go @@ -4,7 +4,7 @@ package appctype import ( - "encoding/json" + jsonv1 "encoding/json" "net/netip" "strings" "testing" @@ -46,7 +46,7 @@ func TestGolden(t *testing.T) { }} var config AppConnectorConfig - if err := json.NewDecoder(strings.NewReader(golden)).Decode(&config); err != nil { + if err := jsonv1.NewDecoder(strings.NewReader(golden)).Decode(&config); err != nil { t.Fatalf("failed to decode golden config: %v", err) } @@ -60,10 +60,10 @@ func TestGolden(t *testing.T) { func TestRoundTrip(t *testing.T) { var config AppConnectorConfig - must.Do(json.NewDecoder(strings.NewReader(golden)).Decode(&config)) - b := must.Get(json.Marshal(config)) + must.Do(jsonv1.NewDecoder(strings.NewReader(golden)).Decode(&config)) + b := must.Get(jsonv1.Marshal(config)) var config2 AppConnectorConfig - must.Do(json.Unmarshal(b, &config2)) + must.Do(jsonv1.Unmarshal(b, &config2)) assertEqual(t, "DNAT", config.DNAT, config2.DNAT) } diff --git a/types/ipproto/ipproto_test.go b/types/ipproto/ipproto_test.go index 102b79cff..527917e75 100644 --- a/types/ipproto/ipproto_test.go +++ b/types/ipproto/ipproto_test.go @@ -5,7 +5,7 @@ package ipproto import ( "encoding" - "encoding/json" + jsonv1 "encoding/json" "fmt" "testing" @@ -123,14 +123,14 @@ func TestProtoUnmarshalJSON(t *testing.T) { for i := range 256 { j := []byte(fmt.Sprintf(`%d`, i)) - must.Do(json.Unmarshal(j, &p)) + must.Do(jsonv1.Unmarshal(j, &p)) if got, want := p, Proto(i); got != want { t.Errorf("Proto(%d) = %v, want %v", i, got, want) } } for name, wantProto := range acceptedNames { - must.Do(json.Unmarshal([]byte(fmt.Sprintf(`"%s"`, name)), &p)) + must.Do(jsonv1.Unmarshal([]byte(fmt.Sprintf(`"%s"`, name)), &p)) if got, want := p, wantProto; got != want { t.Errorf("Proto(%q) = %v, want %v", name, got, want) } diff --git a/types/jsonx/json.go b/types/jsonx/json.go index 3f01ea358..15e4e0a1d 100644 --- a/types/jsonx/json.go +++ b/types/jsonx/json.go @@ -13,7 +13,7 @@ import ( "fmt" "reflect" - "github.com/go-json-experiment/json" + jsonv2 "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" ) @@ -122,7 +122,7 @@ func MakeInterfaceCoders[T any](valuesByName map[string]T) (c struct { if err := enc.WriteToken(jsontext.String(name)); err != nil { return err } - if err := json.MarshalEncode(enc, *val); err != nil { + if err := jsonv2.MarshalEncode(enc, *val); err != nil { return err } if err := enc.WriteToken(jsontext.EndObject); err != nil { @@ -139,7 +139,7 @@ func MakeInterfaceCoders[T any](valuesByName map[string]T) (c struct { *val = zero // store nil interface value for JSON null return nil case tok.Kind() != '{': - return &json.SemanticError{JSONKind: tok.Kind(), GoType: reflect.TypeFor[T]()} + return &jsonv2.SemanticError{JSONKind: tok.Kind(), GoType: reflect.TypeFor[T]()} } var v reflect.Value switch tok, err := dec.ReadToken(); { @@ -154,7 +154,7 @@ func MakeInterfaceCoders[T any](valuesByName map[string]T) (c struct { } v = reflect.New(t) } - if err := json.UnmarshalDecode(dec, v.Interface()); err != nil { + if err := jsonv2.UnmarshalDecode(dec, v.Interface()); err != nil { return err } *val = v.Elem().Interface().(T) diff --git a/types/jsonx/json_test.go b/types/jsonx/json_test.go index 0f2a646c4..584e0a21d 100644 --- a/types/jsonx/json_test.go +++ b/types/jsonx/json_test.go @@ -7,7 +7,7 @@ import ( "errors" "testing" - "github.com/go-json-experiment/json" + jsonv2 "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" "github.com/google/go-cmp/cmp" "tailscale.com/types/ptr" @@ -46,9 +46,9 @@ func (w *InterfaceWrapper) UnmarshalJSONFrom(dec *jsontext.Decoder) error { } func TestInterfaceCoders(t *testing.T) { - var opts json.Options = json.JoinOptions( - json.WithMarshalers(json.MarshalToFunc(interfaceCoders.Marshal)), - json.WithUnmarshalers(json.UnmarshalFromFunc(interfaceCoders.Unmarshal)), + var opts jsonv2.Options = jsonv2.JoinOptions( + jsonv2.WithMarshalers(jsonv2.MarshalToFunc(interfaceCoders.Marshal)), + jsonv2.WithUnmarshalers(jsonv2.UnmarshalFromFunc(interfaceCoders.Unmarshal)), ) errSkipMarshal := errors.New("skip marshal") @@ -105,13 +105,13 @@ func TestInterfaceCoders(t *testing.T) { }} { t.Run(tt.label, func(t *testing.T) { if tt.wantMarshalError != errSkipMarshal { - switch gotJSON, err := json.Marshal(&tt.wantVal); { + switch gotJSON, err := jsonv2.Marshal(&tt.wantVal); { case !errors.Is(err, tt.wantMarshalError): t.Fatalf("json.Marshal(%v) error = %v, want %v", tt.wantVal, err, tt.wantMarshalError) case string(gotJSON) != tt.wantJSON: t.Fatalf("json.Marshal(%v) = %s, want %s", tt.wantVal, gotJSON, tt.wantJSON) } - switch gotJSON, err := json.Marshal(&tt.wantVal.Interface, opts); { + switch gotJSON, err := jsonv2.Marshal(&tt.wantVal.Interface, opts); { case !errors.Is(err, tt.wantMarshalError): t.Fatalf("json.Marshal(%v) error = %v, want %v", tt.wantVal, err, tt.wantMarshalError) case string(gotJSON) != tt.wantJSON: @@ -121,14 +121,14 @@ func TestInterfaceCoders(t *testing.T) { if tt.wantJSON != "" { gotVal := makeFiller() - if err := json.Unmarshal([]byte(tt.wantJSON), &gotVal); !errors.Is(err, tt.wantUnmarshalError) { + if err := jsonv2.Unmarshal([]byte(tt.wantJSON), &gotVal); !errors.Is(err, tt.wantUnmarshalError) { t.Fatalf("json.Unmarshal(%v) error = %v, want %v", tt.wantJSON, err, tt.wantUnmarshalError) } if d := cmp.Diff(gotVal, tt.wantVal); d != "" { t.Fatalf("json.Unmarshal(%v):\n%s", tt.wantJSON, d) } gotVal = makeFiller() - if err := json.Unmarshal([]byte(tt.wantJSON), &gotVal.Interface, opts); !errors.Is(err, tt.wantUnmarshalError) { + if err := jsonv2.Unmarshal([]byte(tt.wantJSON), &gotVal.Interface, opts); !errors.Is(err, tt.wantUnmarshalError) { t.Fatalf("json.Unmarshal(%v) error = %v, want %v", tt.wantJSON, err, tt.wantUnmarshalError) } if d := cmp.Diff(gotVal, tt.wantVal); d != "" { diff --git a/types/key/control.go b/types/key/control.go index 96021249b..6ce8551f0 100644 --- a/types/key/control.go +++ b/types/key/control.go @@ -3,7 +3,7 @@ package key -import "encoding/json" +import jsonv1 "encoding/json" // ControlPrivate is a Tailscale control plane private key. // @@ -37,12 +37,12 @@ func (k ControlPrivate) Public() MachinePublic { // MarshalJSON implements json.Marshaler. func (k ControlPrivate) MarshalJSON() ([]byte, error) { - return json.Marshal(k.mkey.k) + return jsonv1.Marshal(k.mkey.k) } // UnmarshalJSON implements json.Unmarshaler. func (k *ControlPrivate) UnmarshalJSON(bs []byte) error { - return json.Unmarshal(bs, &k.mkey.k) + return jsonv1.Unmarshal(bs, &k.mkey.k) } // SealTo wraps cleartext into a NaCl box (see diff --git a/types/key/control_test.go b/types/key/control_test.go index a98a586f3..6cb7c29cc 100644 --- a/types/key/control_test.go +++ b/types/key/control_test.go @@ -4,7 +4,7 @@ package key import ( - "encoding/json" + jsonv1 "encoding/json" "testing" ) @@ -19,7 +19,7 @@ func TestControlKey(t *testing.T) { var got struct { PrivateKey ControlPrivate } - if err := json.Unmarshal([]byte(serialized), &got); err != nil { + if err := jsonv1.Unmarshal([]byte(serialized), &got); err != nil { t.Fatalf("decoding serialized ControlPrivate: %v", err) } @@ -27,7 +27,7 @@ func TestControlKey(t *testing.T) { t.Fatalf("Serialized ControlPrivate didn't deserialize as expected, got %v want %v", got.PrivateKey, want) } - bs, err := json.Marshal(got) + bs, err := jsonv1.Marshal(got) if err != nil { t.Fatalf("json reserialization of ControlPrivate failed: %v", err) } diff --git a/types/key/derp.go b/types/key/derp.go index 1466b85bc..f94ef6213 100644 --- a/types/key/derp.go +++ b/types/key/derp.go @@ -6,7 +6,7 @@ package key import ( "crypto/subtle" "encoding/hex" - "encoding/json" + jsonv1 "encoding/json" "errors" "fmt" "strings" @@ -26,13 +26,13 @@ type DERPMesh struct { // MarshalJSON implements the [encoding/json.Marshaler] interface. func (k DERPMesh) MarshalJSON() ([]byte, error) { - return json.Marshal(k.String()) + return jsonv1.Marshal(k.String()) } // UnmarshalJSON implements the [encoding/json.Unmarshaler] interface. func (k *DERPMesh) UnmarshalJSON(data []byte) error { var s string - json.Unmarshal(data, &s) + jsonv1.Unmarshal(data, &s) if hex.DecodedLen(len(s)) != len(k.k) { return fmt.Errorf("types/key/derp: cannot unmarshal, incorrect size mesh key len: %d, must be %d, %w", hex.DecodedLen(len(s)), len(k.k), ErrInvalidMeshKey) diff --git a/types/key/disco_test.go b/types/key/disco_test.go index 131fe350f..b03a6b382 100644 --- a/types/key/disco_test.go +++ b/types/key/disco_test.go @@ -5,7 +5,7 @@ package key import ( "bytes" - "encoding/json" + jsonv1 "encoding/json" "testing" ) @@ -55,20 +55,20 @@ func TestDiscoSerialization(t *testing.T) { } var a key - if err := json.Unmarshal([]byte(serialized), &a); err != nil { + if err := jsonv1.Unmarshal([]byte(serialized), &a); err != nil { t.Fatal(err) } if a.Pub != pub { t.Errorf("wrong deserialization of public key, got %#v want %#v", a.Pub, pub) } - bs, err := json.MarshalIndent(a, "", " ") + bs, err := jsonv1.MarshalIndent(a, "", " ") if err != nil { t.Fatal(err) } var b bytes.Buffer - json.Indent(&b, []byte(serialized), "", " ") + jsonv1.Indent(&b, []byte(serialized), "", " ") if got, want := string(bs), b.String(); got != want { t.Error("json serialization doesn't roundtrip") } diff --git a/types/key/hardware_attestation.go b/types/key/hardware_attestation.go index 9d4a21ee4..af776cd84 100644 --- a/types/key/hardware_attestation.go +++ b/types/key/hardware_attestation.go @@ -8,7 +8,7 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/subtle" - "encoding/json" + jsonv1 "encoding/json" "fmt" "io" @@ -28,8 +28,8 @@ const pubkeyLength = 65 // uncompressed P-256 // This key can only be marshalled and unmarshaled on the same machine. type HardwareAttestationKey interface { crypto.Signer - json.Marshaler - json.Unmarshaler + jsonv1.Marshaler + jsonv1.Unmarshaler io.Closer Clone() HardwareAttestationKey IsZero() bool diff --git a/types/key/machine_test.go b/types/key/machine_test.go index 157df9e43..e088b5f35 100644 --- a/types/key/machine_test.go +++ b/types/key/machine_test.go @@ -5,7 +5,7 @@ package key import ( "bytes" - "encoding/json" + jsonv1 "encoding/json" "strings" "testing" ) @@ -68,7 +68,7 @@ func TestMachineSerialization(t *testing.T) { } var a keypair - if err := json.Unmarshal([]byte(serialized), &a); err != nil { + if err := jsonv1.Unmarshal([]byte(serialized), &a); err != nil { t.Fatal(err) } if !a.Priv.Equal(priv) { @@ -78,13 +78,13 @@ func TestMachineSerialization(t *testing.T) { t.Errorf("wrong deserialization of public key, got %#v want %#v", a.Pub, pub) } - bs, err := json.MarshalIndent(a, "", " ") + bs, err := jsonv1.MarshalIndent(a, "", " ") if err != nil { t.Fatal(err) } var b bytes.Buffer - json.Indent(&b, []byte(serialized), "", " ") + jsonv1.Indent(&b, []byte(serialized), "", " ") if got, want := string(bs), b.String(); got != want { t.Error("json serialization doesn't roundtrip") } diff --git a/types/key/node_test.go b/types/key/node_test.go index 80a2dadf9..431e6da17 100644 --- a/types/key/node_test.go +++ b/types/key/node_test.go @@ -6,7 +6,7 @@ package key import ( "bufio" "bytes" - "encoding/json" + jsonv1 "encoding/json" "strings" "testing" ) @@ -83,7 +83,7 @@ func TestNodeSerialization(t *testing.T) { } var a keypair - if err := json.Unmarshal([]byte(serialized), &a); err != nil { + if err := jsonv1.Unmarshal([]byte(serialized), &a); err != nil { t.Fatal(err) } if !a.Priv.Equal(priv) { @@ -93,13 +93,13 @@ func TestNodeSerialization(t *testing.T) { t.Errorf("wrong deserialization of public key, got %#v want %#v", a.Pub, pub) } - bs, err := json.MarshalIndent(a, "", " ") + bs, err := jsonv1.MarshalIndent(a, "", " ") if err != nil { t.Fatal(err) } var b bytes.Buffer - json.Indent(&b, []byte(serialized), "", " ") + jsonv1.Indent(&b, []byte(serialized), "", " ") if got, want := string(bs), b.String(); got != want { t.Error("json serialization doesn't roundtrip") } diff --git a/types/logger/logger.go b/types/logger/logger.go index 6c4edf633..8b9b0a70f 100644 --- a/types/logger/logger.go +++ b/types/logger/logger.go @@ -10,7 +10,7 @@ import ( "bufio" "bytes" "container/list" - "encoding/json" + jsonv1 "encoding/json" "fmt" "io" "log" @@ -45,12 +45,12 @@ type Context context.Context // jenc is a json.Encode + bytes.Buffer pair wired up to be reused in a pool. type jenc struct { buf bytes.Buffer - enc *json.Encoder + enc *jsonv1.Encoder } var jencPool = &sync.Pool{New: func() any { je := new(jenc) - je.enc = json.NewEncoder(&je.buf) + je.enc = jsonv1.NewEncoder(&je.buf) return je }} @@ -378,7 +378,7 @@ func AsJSON(v any) fmt.Formatter { type asJSONResult struct{ v any } func (a asJSONResult) Format(s fmt.State, verb rune) { - v, err := json.Marshal(a.v) + v, err := jsonv1.Marshal(a.v) if err != nil { fmt.Fprintf(s, "%%!JSON-ERROR:%v", err) return diff --git a/types/netlogtype/netlogtype_test.go b/types/netlogtype/netlogtype_test.go index 00f89b228..7a254f603 100644 --- a/types/netlogtype/netlogtype_test.go +++ b/types/netlogtype/netlogtype_test.go @@ -6,7 +6,7 @@ package netlogtype import ( - "encoding/json" + jsonv1 "encoding/json" "math" "net/netip" "testing" @@ -27,7 +27,7 @@ func TestMaxSize(t *testing.T) { Counts{math.MaxUint64, math.MaxUint64, math.MaxUint64, math.MaxUint64}, } - outJSON := must.Get(json.Marshal(cc)) + outJSON := must.Get(jsonv1.Marshal(cc)) if string(outJSON) != maxJSONConnCounts { t.Errorf("JSON mismatch (-got +want):\n%s", cmp.Diff(string(outJSON), maxJSONConnCounts)) } diff --git a/types/netmap/netmap.go b/types/netmap/netmap.go index cc6bec1db..ad13c2928 100644 --- a/types/netmap/netmap.go +++ b/types/netmap/netmap.go @@ -6,7 +6,7 @@ package netmap import ( "cmp" - "encoding/json" + jsonv1 "encoding/json" "fmt" "net/netip" "sort" @@ -438,7 +438,7 @@ func (b *NetworkMap) ConciseDiffFrom(a *NetworkMap) string { } func (nm *NetworkMap) JSON() string { - b, err := json.MarshalIndent(*nm, "", " ") + b, err := jsonv1.MarshalIndent(*nm, "", " ") if err != nil { return fmt.Sprintf("[json error: %v]", err) } diff --git a/types/opt/bool_test.go b/types/opt/bool_test.go index dddbcfc19..d4c8dc742 100644 --- a/types/opt/bool_test.go +++ b/types/opt/bool_test.go @@ -4,7 +4,7 @@ package opt import ( - "encoding/json" + jsonv1 "encoding/json" "flag" "reflect" "strings" @@ -72,7 +72,7 @@ func TestBool(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - j, err := json.Marshal(tt.in) + j, err := jsonv1.Marshal(tt.in) if err != nil { t.Fatal(err) } @@ -87,7 +87,7 @@ func TestBool(t *testing.T) { // And back again: newVal := reflect.New(reflect.TypeOf(tt.in)) out := newVal.Interface() - if err := json.Unmarshal(j, out); err != nil { + if err := jsonv1.Unmarshal(j, out); err != nil { t.Fatalf("Unmarshal %#q: %v", j, err) } got := newVal.Elem().Interface() @@ -123,7 +123,7 @@ func TestBoolEqualBool(t *testing.T) { } func TestUnmarshalAlloc(t *testing.T) { - b := json.Unmarshaler(new(Bool)) + b := jsonv1.Unmarshaler(new(Bool)) n := testing.AllocsPerRun(10, func() { b.UnmarshalJSON(trueBytes) }) if n > 0 { t.Errorf("got %v allocs, want 0", n) diff --git a/types/opt/value_test.go b/types/opt/value_test.go index 890f9a579..d269d7528 100644 --- a/types/opt/value_test.go +++ b/types/opt/value_test.go @@ -4,7 +4,7 @@ package opt import ( - "encoding/json" + jsonv1 "encoding/json" "reflect" "testing" @@ -97,7 +97,7 @@ func TestValue(t *testing.T) { want: bools.IfElse( // Detect whether v1 "encoding/json" supports `omitzero` or not. // TODO(Go1.24): Remove this after `omitzero` is supported. - string(must.Get(json.Marshal(struct { + string(must.Get(jsonv1.Marshal(struct { X int `json:",omitzero"` }{}))) == `{}`, `{"True":true,"False":false}`, // omitzero supported @@ -235,7 +235,7 @@ func TestValue(t *testing.T) { if tt.jsonv2 { j, err = jsonv2.Marshal(tt.in) } else { - j, err = json.Marshal(tt.in) + j, err = jsonv1.Marshal(tt.in) } if err != nil { t.Fatal(err) @@ -254,7 +254,7 @@ func TestValue(t *testing.T) { if tt.jsonv2 { err = jsonv2.Unmarshal(j, out) } else { - err = json.Unmarshal(j, out) + err = jsonv1.Unmarshal(j, out) } if err != nil { t.Fatalf("Unmarshal %#q: %v", j, err) diff --git a/types/prefs/prefs_test.go b/types/prefs/prefs_test.go index d6af745bf..7b5869c8e 100644 --- a/types/prefs/prefs_test.go +++ b/types/prefs/prefs_test.go @@ -5,7 +5,7 @@ package prefs import ( "bytes" - "encoding/json" + jsonv1 "encoding/json" "errors" "net/netip" "reflect" @@ -346,8 +346,8 @@ func TestMarshalUnmarshal(t *testing.T) { }{ { name: "json", - marshal: json.Marshal, - unmarshal: json.Unmarshal, + marshal: jsonv1.Marshal, + unmarshal: jsonv1.Unmarshal, }, { name: "jsonv2", diff --git a/types/tkatype/tkatype_test.go b/types/tkatype/tkatype_test.go index c81891b9c..3e5e2f39b 100644 --- a/types/tkatype/tkatype_test.go +++ b/types/tkatype/tkatype_test.go @@ -4,7 +4,7 @@ package tkatype import ( - "encoding/json" + jsonv1 "encoding/json" "testing" "golang.org/x/crypto/blake2s" @@ -24,7 +24,7 @@ func TestSigHashSize(t *testing.T) { func TestMarshaledSignatureJSON(t *testing.T) { sig := MarshaledSignature("abcdef") - j, err := json.Marshal(sig) + j, err := jsonv1.Marshal(sig) if err != nil { t.Fatal(err) } @@ -34,7 +34,7 @@ func TestMarshaledSignatureJSON(t *testing.T) { } var back MarshaledSignature - if err := json.Unmarshal([]byte(encoded), &back); err != nil { + if err := jsonv1.Unmarshal([]byte(encoded), &back); err != nil { t.Fatal(err) } if string(back) != string(sig) { |
