Skip to content

Failure of golangci-lint-action with go tool Installation Due to go.mod Version Inference #1164

@YOwatari

Description

@YOwatari

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

When using Go 1.24.0's new feature to install golangci-lint, golangci-lint-action fails during execution. The failure is caused by an issue in the version inference mechanism that relies on the go.mod file, leading to incorrect version detection.

Steps to Reproduce:

  1. Set up a GitHub Actions workflow with Go 1.24.0.
  2. Install golangci-lint using the new installation method (e.g., go get -tool).
  3. Run golangci-lint-action.
  4. Observe that the action fails due to an error in inferring the version from the go.mod file.

Expected Behavior:

golangci-lint-action should accurately determine the installed golangci-lint version even when installed with Go 1.24.0's new installation approach, allowing the action to execute successfully.

Suggestion:

By revising the version inference logic in golangci-lint-action to accommodate Go 1.24.0's new installation method, the issue with incorrect version detection can be resolved. This adjustment would prevent execution failures in workflows using this Go version.

Reference Information:

Sample reproducing the issue: golangci-lint-action-124-gomod-tool-directive
Example of a failed GitHub Actions job: Failed Actions Job

Version of golangci-lint

1.64.4

Version of the GitHub Action

6.3.2

Workflow file

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

permissions:
  contents: read
  # Optional: allow read access to pull request. Use with `only-new-issues` option.
  # pull-requests: read

jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v6
        with:
          args: --timeout 5m
          skip-pkg-cache: true
          skip-build-cache: true

Golangci-lint configuration

nothing

Go version

1.24.0

Code example or link to a public repository

nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions