diff --git a/networking/failback.go b/networking/failback.go index 9b7b72c..842858c 100644 --- a/networking/failback.go +++ b/networking/failback.go @@ -63,7 +63,7 @@ func (d *RoundrobinDialer) resolveHost(ctx context.Context, network, connectAddr } if resolvedIPs, err = d.Dialer.Resolver.LookupIP(ctx, network, host); err != nil { - log.Printf("cannot resolve host %s : %s", err) + log.Printf("cannot resolve host %s(%s) : %s", host, network, err) return } diff --git a/types/json.go b/types/json.go index d6ec088..8de5812 100644 --- a/types/json.go +++ b/types/json.go @@ -20,7 +20,7 @@ func (j JSON) String() string { // Unmarshal your JSON variable into dest. func (j JSON) Unmarshal(dest any) error { - iter := misc.JSONCodec.BorrowIterator(nil) + iter := misc.JSONCodec.BorrowIterator(j) defer misc.JSONCodec.ReturnIterator(iter) iter.ReadVal(dest) return iter.Error diff --git a/types/json_test.go b/types/json_test.go index 9ba2327..37be825 100644 --- a/types/json_test.go +++ b/types/json_test.go @@ -18,12 +18,12 @@ func TestJSONUnmarshal(t *testing.T) { t.Parallel() type JSONTest struct { - Name string - Age int + Name string `json:"name"` + Age int `json:"age"` } var jt JSONTest - j := JSON(`{"Name":"hi","Age":15}`) + j := JSON(`{"name":"hi","age":15}`) err := j.Unmarshal(&jt) if err != nil { t.Error(err) @@ -41,8 +41,8 @@ func TestJSONMarshal(t *testing.T) { t.Parallel() type JSONTest struct { - Name string - Age int + Name string `json:"name"` + Age int `json:"age"` } jt := JSONTest{ Name: "hi", @@ -55,8 +55,8 @@ func TestJSONMarshal(t *testing.T) { t.Error(err) } - if j.String() != `{"Name":"hi","Age":15}` { - t.Errorf("expected %s, got %s", `{"Name":"hi","Age":15}`, j.String()) + if j.String() != `{"name":"hi","age":15}` { + t.Errorf("expected %s, got %s", `{"name":"hi","age":15}`, j.String()) } } @@ -92,7 +92,7 @@ func TestJSONMarshalJSON(t *testing.T) { func TestJSONValue(t *testing.T) { t.Parallel() - j := JSON(`{"Name":"hi","Age":15}`) + j := JSON(`{"name":"hi","age":15}`) v, err := j.Value() if err != nil { t.Error(err)