diff --git a/.golangci.yml b/.golangci.yml index a63b7d0..1a49ba0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,7 +18,6 @@ linters: - goprintffuncname - gosimple - govet - - maligned - nakedret - nestif - nolintlint @@ -38,8 +37,6 @@ linters: - exportloopref #for _,p := []int{1, 2, 3} { s.Bar(&p) /* If s stores the pointer, it will be bug.*/ } - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. linters-settings: - maligned: - suggest-new: true funlen: lines: 80 statements: 40 @@ -58,6 +55,7 @@ linters-settings: disabled-checks: - hugeParam - rangeValCopy + - ifElseChain exhaustive: default-signifies-exhaustive: true diff --git a/authenticate/authenticate.go b/authenticate/authenticate.go index fcca417..c70e809 100644 --- a/authenticate/authenticate.go +++ b/authenticate/authenticate.go @@ -123,7 +123,7 @@ func (v *verifiable) verifyAppToken() error { return createError("unauthorized", codes.Unauthenticated, "received unexpected identities") } - applicationId, err := strconv.ParseInt(verifiableHeaders[utils.ApplicationIdHeader], 10, 32) + applicationId, err := strconv.ParseInt(verifiableHeaders[utils.ApplicationIdHeader], 10, 32) //nolint if err != nil { log.Error(log_code.ErrorAuthenticate, errors.WithMessagef(err, "parse appId from redis")) return createError("internal Server error", codes.Internal) diff --git a/conf/remote_config.go b/conf/remote_config.go index 1d903d8..6c77c70 100644 --- a/conf/remote_config.go +++ b/conf/remote_config.go @@ -1,4 +1,3 @@ -//nolint package conf import ( diff --git a/proxy/grpc/handlers/common.go b/proxy/grpc/handlers/common.go index 0654361..0ac4cc0 100644 --- a/proxy/grpc/handlers/common.go +++ b/proxy/grpc/handlers/common.go @@ -35,6 +35,8 @@ const ( errorMsgInternal = "Internal server error" errorMsgInvalidArg = "Not able to read request body" + + metadataSize = 5 ) var json = jsoniter.ConfigFastest @@ -122,7 +124,7 @@ func openStream(headers *fasthttp.RequestHeader, method string, timeout time.Dur } func makeMetadata(r *fasthttp.RequestHeader, method string) (metadata.MD, string) { - md := make(metadata.MD, 5) + md := make(metadata.MD, metadataSize) md[utils.ProxyMethodNameHeader] = []string{method} r.VisitAll(func(key, v []byte) { lowerHeader := bytes.ToLower(key) diff --git a/service/veritification/cacheable_verify.go b/service/veritification/cacheable_verify.go index d63a059..0b5b1b2 100644 --- a/service/veritification/cacheable_verify.go +++ b/service/veritification/cacheable_verify.go @@ -5,6 +5,8 @@ import ( "time" ) +const identitiesCount = 4 + type ( cacheablesVerify struct { cache map[string]cacheInfo @@ -52,7 +54,7 @@ func (cv *cacheablesVerify) Identity(identity map[string]string, uri string) (ma } func (cv *cacheablesVerify) copyCache(cache map[string]string) map[string]string { - resp := make(map[string]string, 4) + resp := make(map[string]string, identitiesCount) for key, value := range cache { resp[key] = value }