diff --git a/golangci.yml b/golangci.yml index a06cb3574..c75ccea06 100644 --- a/golangci.yml +++ b/golangci.yml @@ -26,10 +26,6 @@ run: # on Windows. skip-dirs: - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: false - # which files to skip: they will be analyzed, but issues from them # won't be reported. Default value is empty list, but there is # no need to include all autogenerated files, we confidently recognize @@ -56,7 +52,7 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number + formats: colored-line-number # print lines of code with issue, default is true print-issued-lines: true @@ -71,29 +67,20 @@ output: # all available settings of specific linters linters-settings: depguard: - # Check the list against standard lib. - # Default: false - include-go-root: true - # A list of packages for the list type specified. - # Default: [] - packages: - - "crypto/md5" - - "crypto/sha1" - - "crypto/**/pkix" - ignore-file-rules: - - "**/*_test.go" - additional-guards: - # Do not allow testing packages in non-test files. - - list-type: denylist - include-go-root: true - packages: - - testing - - github.com/stretchr/testify - ignore-file-rules: - - "**/*_test.go" - - "**/*test/*.go" - - "**/testcase.go" - - "**/recordfixtures/*.go" + rules: + non-tests: + files: + - "!$test" + - "!**/testcase.go" + - "!**/*test/*.go" + - "!**/*recordfixtures/*.go" + - "!**/internal/matchers/*.go" + deny: + - pkg: "testing" + - pkg: "github.com/stretchr/testify" + - pkg: "crypto/md5" + - pkg: "crypto/sha1" + - pkg: "crypto/**/pkix" godot: exclude: # Exclude sentence fragments for lists. @@ -113,7 +100,7 @@ linters-settings: min-confidence: 0.8 govet: # report about shadowed variables - check-shadowing: true + shadow: true # settings per analyzer settings: @@ -153,8 +140,9 @@ linters-settings: - name: constant-logical-expr disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + # TODO reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - name: context-as-argument - disabled: false + disabled: true arguments: allowTypesBefore: "*testing.T" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type @@ -292,7 +280,7 @@ linters: enable: - depguard - errcheck - - exportloopref + - copyloopvar - godot - gofmt - goimports @@ -322,3 +310,4 @@ issues: - path: \.pb\.go linters: - govet + exclude-dirs-use-default: false diff --git a/internal/resourcemapping/resourcemapping.go b/internal/resourcemapping/resourcemapping.go index 4b5af517f..510391b82 100644 --- a/internal/resourcemapping/resourcemapping.go +++ b/internal/resourcemapping/resourcemapping.go @@ -221,9 +221,8 @@ func commonResourceAttributesToMonitoredResource(cloudPlatform string, attrs Rea return createMonitoredResource(k8sPod, attrs) } else if _, ok := attrs.GetString(string(semconv.K8SNodeNameKey)); ok { return createMonitoredResource(k8sNode, attrs) - } else { - return createMonitoredResource(k8sCluster, attrs) } + return createMonitoredResource(k8sCluster, attrs) } // Fallback to generic_task