diff --git a/codec/noop.go b/codec/noop.go index ad3564e6..2975c1f2 100644 --- a/codec/noop.go +++ b/codec/noop.go @@ -3,7 +3,6 @@ package codec import ( "encoding/json" "io" - "io/ioutil" ) type noopCodec struct { @@ -20,7 +19,7 @@ func (c *noopCodec) ReadHeader(conn io.Reader, m *Message, t MessageType) error func (c *noopCodec) ReadBody(conn io.Reader, b interface{}) error { // read bytes - buf, err := ioutil.ReadAll(conn) + buf, err := io.ReadAll(conn) if err != nil { return err } diff --git a/go.mod b/go.mod index f8a91073..6ddf07b5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/unistack-org/micro/v3 -go 1.14 +go 1.16 require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible diff --git a/resolver/http/http.go b/resolver/http/http.go index 01543131..0b862a2e 100644 --- a/resolver/http/http.go +++ b/resolver/http/http.go @@ -4,7 +4,7 @@ package http import ( "encoding/json" "errors" - "io/ioutil" + "io" "net/http" "net/url" @@ -61,7 +61,7 @@ func (r *HTTPResolver) Resolve(name string) ([]*resolver.Record, error) { if rsp.StatusCode != 200 { return nil, errors.New("non 200 response") } - b, err := ioutil.ReadAll(rsp.Body) + b, err := io.ReadAll(rsp.Body) if err != nil { return nil, err } diff --git a/util/http/http_test.go b/util/http/http_test.go index dc322bc7..941978b5 100644 --- a/util/http/http_test.go +++ b/util/http/http_test.go @@ -3,7 +3,6 @@ package http import ( - "io/ioutil" "net" "net/http" "testing" @@ -52,7 +51,7 @@ func TestRoundTripper(t *testing.T) { t.Fatal(err) } - b, err := ioutil.ReadAll(w.Body) + b, err := io.ReadAll(w.Body) if err != nil { t.Fatal(err) } @@ -72,7 +71,7 @@ func TestRoundTripper(t *testing.T) { t.Fatal(err) } - b, err = ioutil.ReadAll(rsp.Body) + b, err = io.ReadAll(rsp.Body) if err != nil { t.Fatal(err) } diff --git a/util/token/jwt/jwt_test.go b/util/token/jwt/jwt_test.go index 3de492ef..85f14080 100644 --- a/util/token/jwt/jwt_test.go +++ b/util/token/jwt/jwt_test.go @@ -1,7 +1,7 @@ package jwt import ( - "io/ioutil" + "os" "testing" "time" @@ -10,7 +10,7 @@ import ( ) func TestGenerate(t *testing.T) { - privKey, err := ioutil.ReadFile("test/sample_key") + privKey, err := os.ReadFile("test/sample_key") if err != nil { t.Fatalf("Unable to read private key: %v", err) } @@ -26,11 +26,11 @@ func TestGenerate(t *testing.T) { } func TestInspect(t *testing.T) { - pubKey, err := ioutil.ReadFile("test/sample_key.pub") + pubKey, err := os.ReadFile("test/sample_key.pub") if err != nil { t.Fatalf("Unable to read public key: %v", err) } - privKey, err := ioutil.ReadFile("test/sample_key") + privKey, err := os.ReadFile("test/sample_key") if err != nil { t.Fatalf("Unable to read private key: %v", err) }