fix(lint): golangci-lint warning.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu 2022-12-17 22:59:18 +08:00
parent 6fa9769a31
commit fe402a578a
6 changed files with 11 additions and 7 deletions

View File

@ -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
}

View File

@ -159,6 +159,7 @@ func newApnsClient(cfg *config.ConfYaml, certificate tls.Certificate) (*apns2.Cl
}
if len(certificate.Certificate) > 0 {
//nolint:staticcheck
tlsConfig.BuildNameToCertificate()
}

View File

@ -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")
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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 {