diff --git a/config/config.go b/config/config.go index 044df58..67a531f 100644 --- a/config/config.go +++ b/config/config.go @@ -3,7 +3,7 @@ package config import ( "bytes" "fmt" - "io/ioutil" + "os" "runtime" "strings" @@ -308,7 +308,7 @@ func LoadConf(confPath ...string) (*ConfYaml, error) { viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) if len(confPath) > 0 && confPath[0] != "" { - content, err := ioutil.ReadFile(confPath[0]) + content, err := os.ReadFile(confPath[0]) if err != nil { return conf, err } diff --git a/notify/notification_apns.go b/notify/notification_apns.go index 1ddb9b6..a447094 100644 --- a/notify/notification_apns.go +++ b/notify/notification_apns.go @@ -159,6 +159,7 @@ func newApnsClient(cfg *config.ConfYaml, certificate tls.Certificate) (*apns2.Cl } if len(certificate.Certificate) > 0 { + //nolint:staticcheck tlsConfig.BuildNameToCertificate() } diff --git a/router/server_test.go b/router/server_test.go index fb2f1ee..bee80e8 100644 --- a/router/server_test.go +++ b/router/server_test.go @@ -3,7 +3,7 @@ package router import ( "context" "crypto/tls" - "io/ioutil" + "io" "log" "net/http" "os" @@ -84,7 +84,7 @@ func testRequest(t *testing.T, url string) { assert.NoError(t, err) - _, ioerr := ioutil.ReadAll(resp.Body) + _, ioerr := io.ReadAll(resp.Body) assert.NoError(t, ioerr) assert.Equal(t, "200 OK", resp.Status, "should get a 200") } diff --git a/rpc/example/go/health/main.go b/rpc/example/go/health/main.go index 91d66f2..9a9b62a 100644 --- a/rpc/example/go/health/main.go +++ b/rpc/example/go/health/main.go @@ -8,6 +8,7 @@ import ( "github.com/appleboy/gorush/rpc" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" ) @@ -17,7 +18,7 @@ const ( func main() { // Set up a connection to the server. - conn, err := grpc.Dial(address, grpc.WithInsecure()) + conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/rpc/example/go/send/main.go b/rpc/example/go/send/main.go index f9b0581..437ee30 100644 --- a/rpc/example/go/send/main.go +++ b/rpc/example/go/send/main.go @@ -8,6 +8,7 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) const ( @@ -16,7 +17,7 @@ const ( func main() { // Set up a connection to the server. - conn, err := grpc.Dial(address, grpc.WithInsecure()) + conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/rpc/server_test.go b/rpc/server_test.go index 5d72061..7dcdaac 100644 --- a/rpc/server_test.go +++ b/rpc/server_test.go @@ -8,6 +8,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" ) const gRPCAddr = "localhost:9000" @@ -35,7 +36,7 @@ func TestGracefulShutDownGRPCServer(t *testing.T) { // gRPC client conn conn, err := grpc.Dial( gRPCAddr, - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultCallOptions(grpc.WaitForReady(true)), ) // wait for server ready if err != nil {