Skip to content

contextcheck linter is broken in Github Actions #4551

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

Closed
5 tasks done
ErikPelli opened this issue Mar 20, 2024 · 2 comments
Closed
5 tasks done

contextcheck linter is broken in Github Actions #4551

ErikPelli opened this issue Mar 20, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@ErikPelli
Copy link

ErikPelli commented Mar 20, 2024

Welcome

Description of the problem

I was using the linter contextcheck with golangci-lint version 1.56.2 and earlier and there was absoloutely no problem,
Yesterday golangci-lint 1.57.0 was released and in the pipelines of our companies the following error appeared:

  Running [/home/runner/golangci-lint-1.57.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
  Error: Function `Start$1` should pass the context parameter (contextcheck)
  
  level=warning msg="[runner] Can't process result by autogenerated_exclude processor: can't filter issue result.Issue{FromLinter:\"contextcheck\", Text:\"Function `Start$1` should pass the context parameter\", Severity:\"\", SourceLines:[]string(nil), Replacement:(*result.Replacement)(nil), Pkg:(*packages.Package)(0xc0014d6480), LineRange:(*result.Range)(nil), Pos:token.Position{Filename:\"\", Offset:0, Line:0, Column:0}, HunkPos:0, ExpectNoLint:false, ExpectedNoLintLinter:\"\"}: no file path for issue"
  level=warning msg="[runner] Can't process result by nolint processor: can't filter issue result.Issue{FromLinter:\"contextcheck\", Text:\"Function `Start$1` should pass the context parameter\", Severity:\"\", SourceLines:[]string(nil), Replacement:(*result.Replacement)(nil), Pkg:(*packages.Package)(0xc0014d6480), LineRange:(*result.Range)(nil), Pos:token.Position{Filename:\"\", Offset:0, Line:0, Column:0}, HunkPos:0, ExpectNoLint:false, ExpectedNoLintLinter:\"\"}: no file path for issue"
  level=warning msg="[runner/source_code] Failed to get line 0 for file : failed to get file  lines cache: can't get file  bytes from cache: can't read file : open : no such file or directory"

This issue started yesterday and with the previous version 1.56.2 it was working.
Latest version of contextcheck is from 1 year ago so I suppose this is a problem related to some change in the latest version.

I tried to reproduce this issue locally but I haven't had any success.
I write this issue anyway so maybe someone can discover what it is.
We disabled this specific linter completely in our pipeline as a temporary fix.

Version of golangci-lint

1.57.0

This is the Github Actions pipeline step:

 - name: Lint code
        uses: golangci/golangci-lint-action@v4
        with:
          version: latest
          skip-cache: true
        env:
          GOFLAGS: "-buildvcs=false"

Configuration

run:
  timeout: 2m
  modules-download-mode: readonly

linters:
  enable:
    - gosimple
    - govet
    - ineffassign
    - staticcheck
    - unused
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - containedctx
    - contextcheck
    - decorder
    - dogsled
    - dupl
    - dupword
    - durationcheck
    - errchkjson
    - errorlint
    - errname
    - execinquery
    - exportloopref
    - forbidigo
    - forcetypeassert
    - gci
    - goconst
    - gocritic
    - godot
    - gofmt
    - gofumpt
    - gomodguard
    - goprintffuncname
    - gosec
    - gosmopolitan
    - grouper
    - importas
    - interfacebloat
    - lll
    - loggercheck
    - makezero
    - mirror
    - misspell
    - nakedret
    - nestif
    - nilerr
    - nilnil
    - noctx
    - nolintlint
    - predeclared
    - reassign
    - revive
    - sloglint
    - sqlclosecheck
    - tagalign
    - tenv
    - testableexamples
    - testifylint
    - thelper
    - tparallel
    - unconvert
    - unparam
    - usestdlibvars
    - wastedassign
    - whitespace

  disable:
    - errcheck
    - cyclop
    - deadcode
    - depguard
    - exhaustive
    - exhaustivestruct
    - exhaustruct
    - funlen
    - ginkgolinter
    - gocognit
    - gocyclo
    - godox
    - goheader
    - goimports
    - goerr113
    - golint
    - gomnd
    - gomoddirectives
    - ifshort
    - inamedparam
    - interfacer
    - ireturn
    - maintidx
    - maligned
    - musttag
    - nlreturn
    - nonamedreturns
    - nosnakecase
    - nosprintfhostport
    - paralleltest
    - perfsprint
    - prealloc
    - promlinter
    - protogetter
    - rowserrcheck
    - scopelint
    - spancheck
    - structcheck
    - stylecheck
    - tagliatelle
    - testpackage
    - varcheck
    - varnamelen
    - wrapcheck
    - zerologlint
    - wsl

Go environment

We use GitHub actions with this configuration step:

- name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.22
          cache: false

Verbose output of running

A minimal reproducible example or link to a public repository

Validation

  • Yes, I've included all information above (version, config, etc.).
@ErikPelli ErikPelli added the bug Something isn't working label Mar 20, 2024
Copy link

boring-cyborg bot commented Mar 20, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez
Copy link
Member

ldez commented Mar 20, 2024

duplicate of #4550

@ldez ldez closed this as completed Mar 20, 2024
@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants