fix: code cleanup

Signed-off-by: jianfei.zhang <jianfei.zhang@daocloud.io>
dependabot/go_modules/go.uber.org/atomic-1.10.0
jianfei.zhang 2022-07-26 22:07:22 +08:00
parent 4977877730
commit c26d7f5389
3 changed files with 4 additions and 3 deletions

View File

@ -236,7 +236,7 @@ func (t *tokenSimple) isValidSimpleToken(ctx context.Context, token string) bool
}
select {
case <-t.indexWaiter(uint64(index)):
case <-t.indexWaiter(index):
return true
case <-ctx.Done():
}

View File

@ -87,7 +87,7 @@ func TestNewAuthStoreBcryptCost(t *testing.T) {
func encodePassword(s string) string {
hashedPassword, _ := bcrypt.GenerateFromPassword([]byte(s), bcrypt.MinCost)
return base64.StdEncoding.EncodeToString([]byte(hashedPassword))
return base64.StdEncoding.EncodeToString(hashedPassword)
}
func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testing.T)) {

View File

@ -48,6 +48,7 @@ import (
"golang.org/x/net/http2"
"golang.org/x/net/trace"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
type serveCtx struct {
@ -137,7 +138,7 @@ func (sctx *serveCtx) serve(
var gwmux *gw.ServeMux
if s.Cfg.EnableGRPCGateway {
gwmux, err = sctx.registerGateway([]grpc.DialOption{grpc.WithInsecure()})
gwmux, err = sctx.registerGateway([]grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())})
if err != nil {
sctx.lg.Error("registerGateway failed", zap.Error(err))
return err