golangci / golangci-lint-action

Official GitHub Action for golangci-lint from its authors
https://github.com/marketplace/actions/golangci-lint
MIT License
1.1k stars 152 forks source link

Support install-mode: none #1049

Closed jlevesy closed 4 months ago

jlevesy commented 6 months ago

Welcome

Your feature request related to a problem? Please describe.

Hey,

I'm exploring the idea of using a project level package manager (https://www.jetify.com/devbox/) for our tooling and we would like for it to handle the installation of golangci-lint in our CI.

That being said, the action offers some nice caching capabilities and feedback features that we would still be happy to keep using.

But we can't really do that with the current golangci-lint apparently,

Describe the solution you'd like.

Would it make sense to add a third value (None) to the install mode enum, that would only lookup in the system where golangci-lint is being installed?

Describe alternatives you've considered.

Not using the golangci-lint action :(.

Additional context.

No response

Zxilly commented 5 months ago

go1.23 support is currently available at https://github.com/ldez/golangci-lint/tree/feat/go1.23, but due to limitations of goinstall, it must be manually git cloned and then go install. Adding the none installation option allows users to perform this step themselves and still benefit from the cache mechanism provided by this action.

ldez commented 4 months ago

I wonder if the fact of looking for the binary inside the PATH should be a hard restriction or if the action should allow to define a path to a binary. Cleary, using the PATH is easier. I'm still thinking :thinking:

ldez commented 4 months ago

@jlevesy what is exactly the problem with the current installation of golangci-lint binary? Are you using a custom golangci-lint version? Is there a problem with the binary download? Is it related to custom linters?

jlevesy commented 4 months ago

Are you using a custom golangci-lint version?

No.

Is there a problem with the binary download?

Yes. I'm looking into the possibility of using something else (devbox) to install golangci-lint in the workflow.

Is it related to custom linters?

No.

What is exactly the problem with the current installation of golangci-lint binary?

With the following devbox.json file at the root of my repository

{
    "packages": [
        "go@1.22",
        "golangci-lint@1.59"
    ]
}

Then I can have the following CI workflow defined with the described behavior:

name: CI
on: [pull_request]
jobs:
  ci:
    name: CI
    runs-on: ubuntu-22.04
    steps:
      - name: Checks out the code
        uses: actions/checkout@v3
      - name: Install devbox
        uses: jetify-com/devbox-install-action@v0.10.0 # <- installs go and golangci-lint, makes them available into the path
      - name: Run Linter
        uses: golangci/golangci-lint-action@v6 # <- runs golangci-lint, using the version available from the path.
        with:
           install-mode: none
Zxilly commented 4 months ago

Maybe we can use install-mode: path/current? Find the golangci-lint in the current path, and throw error if we can't find it.

jlevesy commented 4 months ago

Thanks a lot!