Why the execution of golangci-lint takes so much time

See original GitHub issue

In the documentation, it says the execution of golangci-lint could take 1s or 35s without cache, but in my project, I am getting a bigger time to execute the command. For example, I had a run that took 110629ms, and it is a small project. In my machine normally took 4s (based on the output of the time command) In the GitHub action I am using the same setup we have in the documentation

Job definition

  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.29
          args: --timeout 3m0s

Job output

Run golangci/golangci-lint-action@v2
prepare environment
go env
Installed Go in 230ms
Requested golangci-lint 'v1.29', using 'v1.29.0', calculation took 261ms
Installing golangci-lint v1.29.0...
Downloading https://github.com/golangci/golangci-lint/releases/download/v1.29.0/golangci-lint-1.29.0-linux-amd64.tar.gz ...
Cache not found for input keys: golangci-lint.cache-2690-bc8b7dd79789a0f804ae3b455ac3675f98516b1a, golangci-lint.cache-2690-, golangci-lint.cache-
/usr/bin/tar xz --overwrite --warning=no-unknown-keyword -C /home/runner -f /home/runner/work/_temp/2680cbd8-7cef-4ae9-b3f8-76eda97557b9
Installed golangci-lint into /home/runner/golangci-lint-1.29.0-linux-amd64/golangci-lint in 693ms
Prepared env in 957ms

run golangci-lint
  Running [/home/runner/golangci-lint-1.29.0-linux-amd64/golangci-lint run --out-format=github-actions --timeout 3m0s] in [] ...
  golangci-lint found no issues
  Ran golangci-lint in 110629ms

Local machine output

time golangci-lint run --out-format=github-actions --timeout 3m0s
golangci-lint run --out-format=github-actions --timeout 3m0s  4.34s user 5.27s system 399% cpu 2.404 total

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:16
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
Hongbo-Miaocommented, Oct 8, 2021

Just add more info if helps. 😃

My golangci-lint action recently 50% time failed because of timeout issue since a week ago. Mine is a small project too at this moment.

Below are two pull requests which is not related to with Go part (defined in working-directory) at all:

Here is when it is normal https://github.com/Hongbo-Miao/hongbomiao.com/runs/3297080244?check_suite_focus=true

  Running [/home/runner/golangci-lint-1.40.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=api-go] in [/home/runner/work/hongbomiao.com/hongbomiao.com/api-go] ...
  golangci-lint found no issues
  Ran golangci-lint in 6029ms

And here is when it is slow https://github.com/Hongbo-Miao/hongbomiao.com/runs/3298464932?check_suite_focus=true

  Running [/home/runner/golangci-lint-1.40.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=api-go] in [/home/runner/work/hongbomiao.com/hongbomiao.com/api-go] ...
  level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
  
  Error: golangci-lint exit with code 4
  Ran golangci-lint in 71047ms

As you see, both runs happen recently, however, when golangci-lint is slow, it can take a very long time.

5reactions
ngfgrantcommented, Oct 7, 2021

We are also increasingly seeing this behaviour in our builds. Is there anything I can do to help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance | golangci-lint
We schedule linters by a special algorithm which takes estimated execution time into account. It allows to save 10-30% of time when one...
Read more >
golangci-lint: Linters Runner for Go. ...
It takes 300-1000 ms for $GOROOT/src . Smart linters scheduling. We schedule linters by a special algorithm which takes estimated execution time into...
Read more >
golangci
Why the execution of golangci-lint takes so much time $ 0. Created 1 year ago in golangci/golangci-lint-action with 1 comments. In the documentation,...
Read more >
Can't install golangci-lint locally
If golang-ci has properly been installed, the issue is most likely that the installation directory is not in your PATH environment variable.
Read more >
fast & configurable linter for Go - revive
Revive provides more rules compared to golint . Who uses Revive ... Note that while revive configuration is in TOML, that of golangci-lint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found