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

Execution time takes too long with deafult GO111MODULE=on #982

Closed
3 tasks done
Sortren opened this issue Feb 19, 2024 · 3 comments
Closed
3 tasks done

Execution time takes too long with deafult GO111MODULE=on #982

Sortren opened this issue Feb 19, 2024 · 3 comments
Labels
question Further information is requested

Comments

@Sortren
Copy link

Sortren commented Feb 19, 2024

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

Example configuration provided in the README.md has default Go environment variables set, thus GO111MODULE is turned on at this point. Using this, execution time takes so long on Github Actions in comparison to the local run. With the basic list of linters (from golangci-lint.run docs):

  • errcheck
  • gosimple
  • govet
  • ineffassign
  • staticcheck
  • unused

local execution: 20s
github actions execution with workflow file below: over 5 minutes

My fix to get close to the local execution time is to simply pass env: GO111MODULE=off.

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v4
        env:
          GO111MODULE: off
        with:
          version: v1.54

Now the Github Actions execution takes about 40s, so it's drastically better than before.

My question is - what causes this particular issue and how does my fix "resolve" the issue?
It would be nice to know what to do because documentation says nothing about turning off the go modules.
I'm looking forward to get some explanation, this topic is really interesting and I have no clue what happens.

Version of golangci-lint

1.54

Version of the GitHub Action

4

Workflow file

name: golangci-lint
on:
  push:
    branches:
      - master
  pull_request:

permissions:
  contents: read

jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: '1.21'
          cache: false
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v4
        with:
          version: v1.54

Go version

1.21

Code example or link to a public repository

// add your code here
@slawek-gophoto
Copy link

Experiencing the same problem, any solution?

@ldez
Copy link
Member

ldez commented May 1, 2024

If you are using GO111MODULE=off and get golanci-lint to work, I guess it's because you vendored all the dependencies.

In this context, I think the scan will analyze the vendor folder, so it take time.

@ldez ldez added the question Further information is requested label May 1, 2024
@ldez
Copy link
Member

ldez commented May 4, 2024

Another possible problem was the cache of Go modules.
Since v5.0.0, the cache of modules has been removed, so the action is faster.

@ldez ldez closed this as completed May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants