MSP-650 up linter

This commit is contained in:
DeniskaRediska committed 2022-04-29 16:54:22 +04:00
1 parent 0102206734
commit 5157143904
5 files changed
+8 -7

No files matched your search

+1 -3
View File
@@ -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
+1 -1
View File
@@ -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)
-1
View File
@@ -1,4 +1,3 @@
//nolint
package conf
import (
+3 -1
View File
@@ -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)
+3 -1
View File
@@ -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
}