get total different result between local and CI (docker) #5787
-
| I run golangci-lint in my local machine and in docker,got totally different resutls: 
 command: i got: 
 .golangci.ymlversion: "2"
linters-settings:
  funlen:
    lines: 78
    statements: 80
    # Ignore comments when counting lines.
    # Default false
    ignore-comments: true
  goconst:
    min-len: 2
    min-occurrences: 2
  gocyclo:
    min-complexity: 8
  goimports:
    local-prefixes: git.company.com
  govet:
    check-shadowing: true
  lll:
    line-length: 120
  errcheck:
    check-type-assertions: true
  errorlint:
    errorf: true
    asserts: true
    comparison: true
  revive:
    min-confidence: 0
    ignore-generated-header: true
    # https://github.com/mgechev/revive#readme
    rules:
      - name: line-length-limit
        severity: error
        arguments: [ 120 ]
      - name: var-declaration
      - name: unexported-return
      - name: errorf
      - name: blank-imports
      - name: context-as-argument
      - name: error-return
      - name: error-strings
      - name: error-naming
      - name: exported
      - name: if-return
      - name: increment-decrement
      #- name: var-naming
      - name: package-comments
      - name: range
      - name: receiver-naming
      - name: indent-error-flow
      - name: argument-limit
        arguments: [ 5 ]
      - name: cyclomatic
        arguments: [ 8 ]
      #- name: max-public-structs
      #- name: file-header
      - name: empty-block
      - name: superfluous-else
      - name: confusing-naming
      - name: get-return
      #- name: modifies-parameter
      - name: confusing-results
      - name: deep-exit
      - name: unused-parameter
      - name: unreachable-code
      # - name: add-constant
      - name: flag-parameter
      - name: unnecessary-stmt
      - name: struct-tag
      - name: modifies-value-receiver
      - name: constant-logical-expr
      - name: bool-literal-in-expr
      - name: redefines-builtin-id
      - name: function-result-limit
        arguments: [ 5 ]
      - name: imports-blacklist
      - name: range-val-in-closure
      - name: range-val-address
      - name: waitgroup-by-value
      - name: atomic
      - name: empty-lines
      - name: call-to-gc
      - name: duplicated-imports
      - name: import-shadowing
      - name: bare-return
      - name: unused-receiver
      - name: unhandled-error
      - name: cognitive-complexity
        arguments: [ 30 ]
      - name: string-of-int
      #- name: string-format
      - name: early-return
      - name: unconditional-recursion
      - name: identical-branches
      - name: defer
      - name: unexported-naming
      #- name: function-length
linters:
  disable-all: true
  enable:
    ## enabled by default
    - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
    - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
    - ineffassign # detects when assignments to existing variables are not used
    - staticcheck # is a go vet on steroids, applying a ton of static analysis checks
    - unused # checks for unused constants, variables, functions and types
    ## disabled by default
    - asasalint # checks for pass []any as any in variadic func(...any)
    - asciicheck # checks that your code does not contain non-ASCII identifiers
    - bidichk # checks for dangerous unicode character sequences
    - bodyclose # checks whether HTTP response body is closed successfully
    - cyclop # checks function and package cyclomatic complexity
    - dupl # tool for code clone detection
    - durationcheck # checks for two durations multiplied together
    - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
    - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
    - exhaustive # checks exhaustiveness of enum switch statements
    - forbidigo # forbids identifiers
    - funlen # tool for detection of long functions
    - gocheckcompilerdirectives # validates go compiler directive comments (//go:)
    - gocognit # computes and checks the cognitive complexity of functions
    - goconst # finds repeated strings that could be replaced by a constant
    - gocritic # provides diagnostics that check for bugs, performance and style issues
    - gocyclo # computes and checks the cyclomatic complexity of functions
    - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
    - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
    - goprintffuncname # checks that printf-like functions are named with f at the end
    - gosec # inspects source code for security problems
    - lll # reports long lines
    - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
    - makezero # finds slice declarations with non-zero initial length
    - musttag # enforces field tags in (un)marshaled structs
    - nakedret # finds naked returns in functions greater than a specified function length
    - nestif # reports deeply nested if statements
    - nilerr # finds the code that returns nil even if it checks that the error is not nil
    - nilnil # checks that there is no simultaneous return of nil error and an invalid value
    - noctx # finds sending http request without context.Context
    - nonamedreturns # reports all named returns
    - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
    - predeclared # finds code that shadows one of Go's predeclared identifiers
    - promlinter # checks Prometheus metrics naming via promlint
    - reassign # checks that package variables are not reassigned
    - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
    - rowserrcheck # checks whether Err of rows is checked successfully
    - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
    - testableexamples # checks if examples are testable (have an expected output)
    - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
    - unconvert # removes unnecessary type conversions
    - unparam # reports unused function parameters
    - usestdlibvars # detects the possibility to use variables/constants from the Go standard library
    - wastedassign # finds wasted assignment statements
    - whitespace # detects leading and trailing whitespace
    - usetesting # Reports uses of functions with replacement inside the testing package
formatters:
  # Enable specific formatter.
  # Default: [] (uses standard Go formatting)
  enable:
    - goimports
run:
  timeout: 10m
  skip-dirs:
      # - test/testdata_etc
    - pkg/mock
    - pkg/thirdparty/db/mock
    - pkg/thirdparty/cloudapi/mock
  skip-files:
    - pkg/thirdparty/.*/.*_audit.go
    - pkg/kube/.*_audit.go	
issues:
  # Maximum count of issues with the same text.
  # Set to 0 to disable.
  # Default: 3
  max-same-issues: 50
  exclude-rules:
    - path: '(.+)interface.go'
      linters:
        - lll
        - revive
    - path: "_test.go"
      linters:
        - bodyclose
        - dupl
        - funlen
        - goconst
        - gosec
        - noctx
        - wrapcheck
output:
  formats:
    html:
      path: output.html
why this? | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            ldez
          
      
      
        May 8, 2025 
      
    
    Replies: 1 comment
-
| https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        ldez
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors