diff --git a/.golangci.yml b/.golangci.yml index 24a9668f39..85ea11dce1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,7 @@ linters: - govet - ineffassign - misspell # Detects commonly misspelled English words in comments. - - nakedret + - nakedret # Detects uses of naked returns. - nilerr # Detects code that returns nil even if it checks that the error is not nil. - nolintlint # Detects ill-formed or insufficient nolint directives. - perfsprint # Detects fmt.Sprintf uses that can be replaced with a faster alternative. @@ -82,8 +82,9 @@ linters-settings: lll: line-length: 200 nakedret: - command: nakedret - pattern: ^(?P.*?\\.go):(?P\\d+)\\s*(?P.*)$ + # Disallow naked returns if func has more lines of code than this setting. + # Default: 30 + max-func-lines: 0 revive: rules: diff --git a/cli/command/container/cp.go b/cli/command/container/cp.go index 5eb3d7113c..85e9f6164f 100644 --- a/cli/command/container/cp.go +++ b/cli/command/container/cp.go @@ -201,9 +201,10 @@ func runCopy(ctx context.Context, dockerCli command.Cli, opts copyOptions) error } } -func resolveLocalPath(localPath string) (absPath string, err error) { - if absPath, err = filepath.Abs(localPath); err != nil { - return +func resolveLocalPath(localPath string) (absPath string, _ error) { + absPath, err := filepath.Abs(localPath) + if err != nil { + return "", err } return archive.PreserveTrailingDotOrSeparator(absPath, localPath), nil } diff --git a/cli/internal/oauth/jwt.go b/cli/internal/oauth/jwt.go index 87ad1024e9..437ef42569 100644 --- a/cli/internal/oauth/jwt.go +++ b/cli/internal/oauth/jwt.go @@ -56,15 +56,19 @@ type Source struct { } // GetClaims returns claims from an access token without verification. -func GetClaims(accessToken string) (claims Claims, err error) { +func GetClaims(accessToken string) (Claims, error) { token, err := parseSigned(accessToken) if err != nil { - return + return Claims{}, err } + var claims Claims err = token.UnsafeClaimsWithoutVerification(&claims) + if err != nil { + return Claims{}, err + } - return + return claims, nil } // allowedSignatureAlgorithms is a list of allowed signature algorithms for JWTs.