Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run linter goanalysis_metalinter 1.24.x: failed prerequisites #995

Closed
marcelloh opened this issue Mar 16, 2020 · 18 comments
Closed

Can't run linter goanalysis_metalinter 1.24.x: failed prerequisites #995

marcelloh opened this issue Mar 16, 2020 · 18 comments
Labels
bug Something isn't working cursed This issue is doomed.

Comments

@marcelloh
Copy link

I still have the same issue (but you guys closed it, which you shouldn't, because it is not fixed)

Using the new 1.24.0 with Go 1.14

Config file
linters-settings:
  depguard:
    list-type: blacklist
    packages:
      # logging is allowed only by logutils.Log, logrus
      # is allowed to use only in logutils package
      - github.com/sirupsen/logrus
  dogsled:
    # checks assignments with too many blank identifiers; default is 2
    max-blank-identifiers: 2
  dupl:
    threshold: 100
  funlen:
    lines: 100
    statements: 50
  gocognit:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 10
  goconst:
    min-len: 2
    min-occurrences: 5
  gocritic:
    enabled-tags:
      - diagnostic
      - experimental
      - opinionated
      - performance
      - style
    disabled-checks:
      - wrapperFunc
      - dupImport # https://github.com/go-critic/go-critic/issues/845
      - ifElseChain
      - octalLiteral
      - commentedOutCode
      - commentFormatting
  gocyclo:
    min-complexity: 12
  godox:
    # report any comments starting with keywords, this is useful for TODO or FIXME comments that
    # might be left in the code accidentally and should be resolved before merging
    keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
      - NOTE
      - OPTIMIZE # marks code that should be optimized before merging
      - HACK # marks hack-arounds that should be removed before merging
  gofmt:
    # simplify code: gofmt with `-s` option, true by default
    simplify: true
  goimports:
    # put imports beginning with prefix after 3rd-party packages;
    # it's a comma-separated list of prefixes
    local-prefixes: github.com/org/project
  golint:
    min-confidence: 0.8
  govet:
    # report about shadowed variables
    check-shadowing: true
    settings:
      printf:
        funcs:
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
  lll:
    line-length: 120
  maligned:
    suggest-new: true
  misspell:
    locale: US, NL
  nakedret:
    # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
    max-func-lines: 30
  prealloc:
    # XXX: we don't recommend using this linter before doing performance profiling.
    # For most programs usage of prealloc will be a premature optimization.

    # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
    # True by default.
    simple: true
    range-loops: true # Report preallocation suggestions on range loops, true by default
    for-loops: false # Report preallocation suggestions on for loops, false by default
  whitespace:
    auto-fix: true
  wsl:
    # If true append is only allowed to be cuddled if appending value is
    # matching variables, fields or types on line above. Default is true.
    strict-append: true
    # Allow calls and assignments to be cuddled as long as the lines have any
    # matching variables, fields or types. Default is true.
    allow-assign-and-call: true
    # Allow multiline assignments to be cuddled. Default is true.
    allow-multiline-assign: true
    # Allow case blocks to end with a whitespace.
    allow-case-traling-whitespace: true
    # Allow declarations (var) to be cuddled.
    allow-cuddle-declarations: false

linters:
  disable-all: true
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dogsled
    - dupl
    - errcheck
    - funlen
    - gochecknoglobals
    - gochecknoinits
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godox
    - gofmt
    - goimports
    - golint
    - gosec
    - gosimple
    - govet
    - ineffassign
    - interfacer
    - lll
    - maligned
    - misspell
    - nakedret
    - prealloc
    - scopelint
    - staticcheck
    - structcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    #- unused
    - varcheck
    - whitespace
  disable:
    #- goanalysis_metalinter
    #- maligned
    #- prealloc
    #- gochecknoinits
    #- goimports
    #- gofmt
  fast: false

run:
  skip-dirs:
    - test/testdata_etc
  build-tags:
    - codeanalysis

# output configuration options
output:
  # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
  format: colored-line-number

  # print lines of code with issue, default is true
  print-issued-lines: true

  # print linter name in the end of issue text, default is true
  print-linter-name: true

issues:
  exclude-rules:
    - text: "G107:"
      linters:
        - gosec
    - text: "weak cryptographic primitive"
      linters:
        - gosec
    #- text: "unnecessary leading newline"
    #  linters:
    #    - whitespace
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
#service:
#  golangci-lint-version: 1.15.x # use the fixed version to not introduce new linters unexpectedly
#  prepare:
#    - echo "here I can run custom commands, but no preparation needed for this repo"
Go environment
go version go1.14 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/marcelloh/go/bin"
GOCACHE="/Users/marcelloh/Library/Caches/go-build"
GOENV="/Users/marcelloh/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="bitbucket.org/aanzeeonline"
GONOSUMDB="bitbucket.org/aanzeeonline"
GOOS="darwin"
GOPATH="/Users/marcelloh/go"
GOPRIVATE="bitbucket.org/aanzeeonline"
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/marcelloh/data/go-business/impact/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sw/g1d8300x5mjgfkr7c6td2pq00000gn/T/go-build853007795=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
INFO [config_reader] Config search paths: [./ /Users/marcelloh/data/go-business/impact /Users/marcelloh/data/go-business /Users/marcelloh/data /Users/marcelloh /Users /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace] 
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace] 
INFO [loader] Go packages loading at mode 575 (types_sizes|name|deps|exports_file|files|imports|compiled_files) took 240.699611ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.319414ms 
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 760.762635ms with top 10 stages: buildir: 156.838969ms, buildssa: 127.551009ms, gocritic: 48.135795ms, dupl: 36.867479ms, interfacer: 35.853932ms, unparam: 34.103223ms, goimports: 27.338886ms, unconvert: 19.332466ms, depguard: 18.441935ms, gosec: 16.821912ms 
WARN [runner] Can't run linter goanalysis_metalinter: S1002: failed prerequisites: [([email protected]/aanzeeonline/impact/compare, [email protected]/aanzeeonline/impact/compare): analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]] 
INFO [runner] processing took 4.153µs with stages: max_same_issues: 2.073µs, nolint: 334ns, skip_dirs: 254ns, max_from_linter: 164ns, cgo: 139ns, autogenerated_exclude: 122ns, filename_unadjuster: 118ns, path_shortener: 118ns, skip_files: 118ns, exclude-rules: 115ns, diff: 114ns, path_prettifier: 111ns, exclude: 108ns, identifier_marker: 108ns, source_code: 53ns, uniq_by_line: 52ns, max_per_file_from_linter: 52ns 
INFO [runner] linters took 309.345133ms with stages: goanalysis_metalinter: 309.257375ms 
ERRO Running error: S1002: failed prerequisites: [([email protected]/aanzeeonline/impact/compare, [email protected]/aanzeeonline/impact/compare): analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]] 
INFO Memory: 7 samples, avg is 109.5MB, max is 138.6MB 
INFO Execution took 562.48163ms  

It's always on the same part. What is interesting about it, that it complains about a struct and a function not being present. They are present within the package, only not in that file.
The software compiles, so there's nothing wrong, only the linter sees that differently. :-(

@therightstuff
Copy link

linter began failing suddenly a short while ago, just upgraded (brew) from 1.23.2 -> 1.23.8, working again. considering description above, i suspect it was re-broken :P

@marcelloh
Copy link
Author

this issue is about the new 1.24.x versions

@Luzifer
Copy link

Luzifer commented Mar 25, 2020

Having the same issue with a slight random effect:

We do have a repo containing several /cmd/... tools which we are testing in a shell-loop using golangci-lint run --modules-download-mode=vendor --timeout=5m.

  • When executed on a local system (Archlinux, Go 1.14, golangci-lint@master) it fails once and afterwards all exeecutions succeeds
  • When executed in a Docker container (Alpine, Go 1.14, [email protected], @master, @1.23.8, @1.23.2) it fails randomly in different executions

That "random" has following effect:

  • Execution 1: tool1 fails, tool2 succeeds, tool3 fails
  • Execution 2: tool1 fails, tool2 succeeds, tool3 succeeds
  • Execution 3: tool1 succeeds, tool2 fails, tool3 succeeds

Between those executions no code chance was made, all executions were made in a fresh container from the same image…

@mimol91
Copy link

mimol91 commented Apr 1, 2020

golangci-lint has version 1.24.0 built from 6fd4383 on 2020-03-15T11:30:52Z

Running error: SA4016: failed prerequisites: [([email protected]/my/project/cmd, [email protected]/my/project/cmd): analysis skipped: errors in package: [/Users/User/go/src/github.com/my/project/cmd/generate.go:36:39: cannot use es.NewClient(conf.R.OverviewElasticsearch) (value of type *elastic.Client) as *elastic.Client value in argument to repo.NewOverviewRepo /Users/adam/go/src/github.com/my/project/cmd/generate.go:37:31: cannot use es.NewClient(conf.R.RoboElasticsearch) (value of type *elastic.Client) as *elastic.Client value in argument to repo.NewRoboRepo]]
Config
  run:
  concurrency: 1
  skip-dirs:
    - vendor
  #    - autogenerated_by_my_lib

  skip-files:
  #    - ".*\\.my\\.go$"
  #    - lib/bad.go
  timeout: 5m
linters-settings:
  funlen:
    lines: 200
    statements: 40
  golint:
    # minimal confidence for issues, default is 0.8
    min-confidence: 0.8
  gocyclo:
    min-complexity: 30
  gocritic:
    enabled-checks:
      - appendAssign #Bugs
      - argOrder
      - caseOrder
      - dupArg
      - dupBranchBody
      - dupCase
      - dupSubExpr
      - flagDeref
linters:
  enable:
    - bodyclose
    - golint
    - unconvert
    - gocyclo
    - gofmt
    - unparam
    - goimports
    - dogsled
    - nakedret
    - scopelint
    - funlen
    - gocritic

@nightah
Copy link

nightah commented Apr 6, 2020

Also seeing this same issue and it seems very erratic/intermittent.

golangci-lint has version 1.24.0 built from 6fd4383 on 2020-03-15T11:38:02Z
buildkite@f8f3c3fcd96f:/buildkite/builds/authelia/authelia$ golangci-lint cache clean
buildkite@f8f3c3fcd96f:/buildkite/builds/authelia/authelia$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /buildkite/builds/authelia/authelia /buildkite/builds/authelia /buildkite/builds /buildkite /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 19 linters: [deadcode errcheck gocyclo goimports golint gosimple govet ineffassign interfacer maligned misspell prealloc staticcheck structcheck typecheck unparam unused varcheck whitespace]
INFO [lintersdb] Active 19 linters: [deadcode errcheck gocyclo goimports golint gosimple govet ineffassign interfacer maligned misspell prealloc staticcheck structcheck typecheck unparam unused varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (compiled_files|files|name|types_sizes|deps|exports_file|imports) took 2.472966343s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 16.695426ms
INFO [runner/unused/goanalysis] analyzers took 16.469084845s with top 10 stages: buildir: 16.152201785s, U1000: 316.88306ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 27.581640143s with top 10 stages: buildir: 19.458378773s, buildssa: 1.948842144s, inspect: 825.846284ms, fact_deprecated: 603.72258ms, ctrlflow: 538.225424ms, printf: 516.553304ms, goimports: 500.122194ms, interfacer: 472.460409ms, fact_purity: 454.141741ms, unparam: 367.787968ms
WARN [runner] Can't run linter goanalysis_metalinter: SA4000: failed prerequisites: [([email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test], [email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test], [email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test]): analysis skipped: errors in package: [/buildkite/builds/authelia/authelia/internal/middlewares/authelia_context_test.go:24:20: cannot use userProvider (variable of type *mocks.MockUserProvider) as authentication.UserProvider value in struct literal: wrong type for method GetDetails /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:44:60: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(newArgs(retriever)) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:61:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:84:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:102:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:120:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:143:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:190:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:198:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:211:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:224:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:240:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:255:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:272:53: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(args, next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:291:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:310:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next)]]
INFO [runner] Issues before processing: 18, after processing: 17
INFO [runner] Processors filtering stat (out/in): skip_files: 17/18, path_shortener: 17/17, max_per_file_from_linter: 17/17, cgo: 18/18, skip_dirs: 17/17, exclude: 17/17, exclude-rules: 17/17, uniq_by_line: 17/17, diff: 17/17, autogenerated_exclude: 17/17, identifier_marker: 17/17, nolint: 17/17, max_from_linter: 17/17, filename_unadjuster: 18/18, path_prettifier: 18/18, max_same_issues: 17/17, source_code: 17/17
INFO [runner] processing took 4.307274ms with stages: nolint: 3.095692ms, exclude: 411.448µs, path_prettifier: 310.953µs, identifier_marker: 162.222µs, autogenerated_exclude: 156.928µs, skip_dirs: 95.728µs, skip_files: 26.223µs, source_code: 14.248µs, uniq_by_line: 14.218µs, cgo: 7.449µs, path_shortener: 4.783µs, filename_unadjuster: 2.319µs, max_per_file_from_linter: 1.928µs, max_same_issues: 1.55µs, diff: 616ns, max_from_linter: 502ns, exclude-rules: 467ns
INFO [runner] linters took 7.363476047s with stages: unused: 4.560667792s, goanalysis_metalinter: 2.798395259s
ERRO Running error: SA4000: failed prerequisites: [([email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test], [email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test], [email protected]/authelia/authelia/internal/middlewares_test [github.com/authelia/authelia/internal/middlewares.test]): analysis skipped: errors in package: [/buildkite/builds/authelia/authelia/internal/middlewares/authelia_context_test.go:24:20: cannot use userProvider (variable of type *mocks.MockUserProvider) as authentication.UserProvider value in struct literal: wrong type for method GetDetails /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:44:60: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(newArgs(retriever)) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:61:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:84:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:102:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:120:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:143:46: cannot use mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationStart(args) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:190:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:198:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:211:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:224:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:240:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:255:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:272:53: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(args, next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:291:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next) /buildkite/builds/authelia/authelia/internal/middlewares/identity_verification_test.go:310:64: cannot use s.mock.Ctx (variable of type *middlewares.AutheliaCtx) as *middlewares.AutheliaCtx value in argument to middlewares.IdentityVerificationFinish(newFinishArgs(), next)]]
INFO Memory: 97 samples, avg is 1467.2MB, max is 3505.7MB
INFO Execution took 9.866739853s

You should be able to reproduce it with: https://github.com/authelia/authelia with the following configuration:

Config
run:
  timeout: 3m
  skip-files:
    - "migration_local.go$"
    - "migration_mongo.go$"

linters-settings:
  gocyclo:
    min-complexity: 15
  goimports:
    local-prefixes: github.com/authelia/authelia

linters:
  disable-all: false
  enable:
    - gocyclo
    - goimports
    - golint
    - interfacer
    - maligned
    - misspell
    - prealloc
    - unparam
    - whitespace

issues:
  max-issues-per-linter: 0
  max-same-issues: 0

@bishtawi
Copy link

bishtawi commented Apr 13, 2020

I am also encountering this issue. What is weird is that I cannot reproduce it locally on my machine. The bug only triggers on my CI (Gitlab). Running Go 1.14 and golangci-lint 1.24.0 both locally and in the CI. Go code compiles successfully, and all unit tests succeed, so there are no compile errors present in the code. And like other people have commented, the "failed prerequisites" error isnt always consistent. It fails on different parts of the code for whatever reason.

#827 is the original closed issue that OP referenced.

@fho
Copy link

fho commented Apr 21, 2020

I encountered the same issue after updating golangci-lint 1.23.8->1.24.0 and Golang 1.14.1->1.14.2.
The issue also only happened in CI runs.

We are running multiple golangci-lint instances in docker containers in parallel.
The docker containers share the go-cache and the golangci-lint cache directory via a volume mount.

Removing the volume mount for the golangci-lint cache directory fixed the issue.
It seems to be a concurrency issue when multiple golangci-lint instances access the same golangci-lint cache directory.

@Luzifer
Copy link

Luzifer commented Apr 21, 2020

It seems to be a concurrency issue when multiple golangci-lint instances access the same golangci-lint cache directory.

Cannot confirm. We're running builds within a Docker container without volume mounts and the first build always produces errors while a second (sequential) build in the same container does no longer produce those errors. There is no concurrency involved on our side when experiencing this.

@ernado ernado added bug Something isn't working cursed This issue is doomed. labels Apr 22, 2020
@ernado
Copy link
Member

ernado commented Apr 22, 2020

For those who can't reproduce this issue locally: please try cleaning golangci cache before running.

$ golangci-lint cache clean

@ernado ernado mentioned this issue Apr 22, 2020
3 tasks
ernado added a commit that referenced this issue Apr 22, 2020
Hotfix for `failed prerequisites` errors.
Actual cause is still unknown.

Revert: #987
Ref: #994, #995, #1011
@fho
Copy link

fho commented Apr 23, 2020

@ernado cleaning the cache does not help to reproduce the issue locally with version 1.24.0 for me

@ernado
Copy link
Member

ernado commented Apr 23, 2020

Please do golangci-lint cache clean again and upgrade to v1.25.0

@fho
Copy link

fho commented Apr 23, 2020

@ernado I can not reproduce the error locally neither with 1.24.0 nor with 1.25.0,
cleaning the cache before running golangci-lint does not change the result

@ernado
Copy link
Member

ernado commented Apr 23, 2020

@fho the 1.25.0 should not contain this issue AFAIK

@hgtgh
Copy link

hgtgh commented Apr 23, 2020

I fixed the problem with:

GO111MODULE=on
CGO_ENABLED=0

@ernado
Copy link
Member

ernado commented Apr 23, 2020

Closing this for now.

Please open new issue if problem will reappear, but ensure that you are installing golangci-lint either via binary or via go modules.

Thanks everyone.

@ernado ernado closed this as completed Apr 23, 2020
jirfag added a commit that referenced this issue May 3, 2020
The primary improvement is in early clearing of
analyzed package's TypeInfo, facts, etc for
whole program analyzers (`unused`). Clear it when it
becomes unused and GC collects them early. Initially this
clearing was performed for all analyzers except `unused`.

Update staticcheck from v0.0.1-2019.2.3 to v0.0.1-2020.1.4

Also in this commit:
  * speed up loading packages from export data (2.5s -> 2.1s for std)
    by not using mutex for export data since it was allowed in
    x/tools#07722704da13
  * make an order of execution of linters stable
  * update renameio and robustio
  * use robustio in caching

Relates: #987, #994, #995, #1011
jirfag added a commit that referenced this issue May 3, 2020
The primary improvement is in early clearing of
analyzed package's TypeInfo, facts, etc for
whole program analyzers (`unused`). Clear it when it
becomes unused and GC collects them early. Initially this
clearing was performed for all analyzers except `unused`.

Update staticcheck from v0.0.1-2019.2.3 to v0.0.1-2020.1.4

Also in this commit:
  * speed up loading packages from export data (2.5s -> 2.1s for std)
    by not using mutex for export data since it was allowed in
    x/tools#07722704da13
  * make an order of execution of linters stable
  * update renameio and robustio
  * use robustio in caching

Relates: #987, #994, #995, #1011
jirfag added a commit that referenced this issue May 3, 2020
The primary improvement is in early clearing of
analyzed package's TypeInfo, facts, etc for
whole program analyzers (`unused`). Clear it when it
becomes unused and GC collects them early. Initially this
clearing was performed for all analyzers except `unused`.

Update staticcheck from v0.0.1-2019.2.3 to v0.0.1-2020.1.4

Also in this commit:
  * speed up loading packages from export data (2.5s -> 2.1s for std)
    by not using mutex for export data since it was allowed in
    x/tools#07722704da13
  * make an order of execution of linters stable
  * update renameio and robustio
  * use robustio in caching

Relates: #987, #994, #995, #1011
jirfag added a commit that referenced this issue May 5, 2020
The primary improvement is in early clearing of
analyzed package's TypeInfo, facts, etc for
whole program analyzers (`unused`). Clear it when it
becomes unused and GC collects them early. Initially this
clearing was performed for all analyzers except `unused`.

Update staticcheck from v0.0.1-2019.2.3 to v0.0.1-2020.1.4

Also in this commit:
  * speed up loading packages from export data (2.5s -> 2.1s for std)
    by not using mutex for export data since it was allowed in
    x/tools#07722704da13
  * make an order of execution of linters stable
  * update renameio and robustio
  * use robustio in caching

Relates: #987, #994, #995, #1011
@AdminTurnedDevOps
Copy link

Is this issue reoccurring in version 1.31.0 on Windows 10? It works on MacOS, but Windows still appears to be borked.

@zhenyulin
Copy link

I'm running version 1.31.0 on MacOS with Go 1.15, having this issue

@drjuarez
Copy link

drjuarez commented Oct 2, 2020

I was able to get around this issue on macOS Catalina (10.15.6)

My issue was the installation was taking a previously installed version and not the new home-brew install. I found something was fishy by checking the version

golangci-lint version
 # -> golangci-lint has version master built from ? on master

I uninstalled the brew version:

brew uninstall golangci/tap/golangci-lint

did a find on my root file system for any

sudo find / | grep golangci-lint

rm any golangci-lint binaries in your go paths

reinstalled golangci

brew upgrade golangci/tap/golangci-lint
brew install golangci/tap/golangci-lint

Verify Version

golangci-lint version
 # -> golangci-lint has version 1.31.0 built from 3d6d0e7 on 2020-09-07T15:14:41Z

Now I can run linter without any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cursed This issue is doomed.
Projects
None yet
Development

No branches or pull requests