update to go 1.16

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-02-17 23:38:32 +03:00
parent 5596345382
commit cf2aa827e4
5 changed files with 10 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package codec
import ( import (
"encoding/json" "encoding/json"
"io" "io"
"io/ioutil"
) )
type noopCodec struct { 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 { func (c *noopCodec) ReadBody(conn io.Reader, b interface{}) error {
// read bytes // read bytes
buf, err := ioutil.ReadAll(conn) buf, err := io.ReadAll(conn)
if err != nil { if err != nil {
return err return err
} }

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/unistack-org/micro/v3 module github.com/unistack-org/micro/v3
go 1.14 go 1.16
require ( require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgrijalva/jwt-go v3.2.0+incompatible

View File

@ -4,7 +4,7 @@ package http
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"io/ioutil" "io"
"net/http" "net/http"
"net/url" "net/url"
@ -61,7 +61,7 @@ func (r *HTTPResolver) Resolve(name string) ([]*resolver.Record, error) {
if rsp.StatusCode != 200 { if rsp.StatusCode != 200 {
return nil, errors.New("non 200 response") return nil, errors.New("non 200 response")
} }
b, err := ioutil.ReadAll(rsp.Body) b, err := io.ReadAll(rsp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -3,7 +3,6 @@
package http package http
import ( import (
"io/ioutil"
"net" "net"
"net/http" "net/http"
"testing" "testing"
@ -52,7 +51,7 @@ func TestRoundTripper(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
b, err := ioutil.ReadAll(w.Body) b, err := io.ReadAll(w.Body)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -72,7 +71,7 @@ func TestRoundTripper(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
b, err = ioutil.ReadAll(rsp.Body) b, err = io.ReadAll(rsp.Body)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -1,7 +1,7 @@
package jwt package jwt
import ( import (
"io/ioutil" "os"
"testing" "testing"
"time" "time"
@ -10,7 +10,7 @@ import (
) )
func TestGenerate(t *testing.T) { func TestGenerate(t *testing.T) {
privKey, err := ioutil.ReadFile("test/sample_key") privKey, err := os.ReadFile("test/sample_key")
if err != nil { if err != nil {
t.Fatalf("Unable to read private key: %v", err) t.Fatalf("Unable to read private key: %v", err)
} }
@ -26,11 +26,11 @@ func TestGenerate(t *testing.T) {
} }
func TestInspect(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 { if err != nil {
t.Fatalf("Unable to read public key: %v", err) 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 { if err != nil {
t.Fatalf("Unable to read private key: %v", err) t.Fatalf("Unable to read private key: %v", err)
} }