Description
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
It looks like some version of golangci-lint can require a specific version of Go, which adds a line to the output when installing it, which makes the action use the wrong install path.
Here is part of the install output:
go: github.com/golangci/[email protected] requires go >= 1.22.1; switching to go1.22.6
touch /home/runner/go/bin/golangci-lint
Installed golangci-lint into github.com/golangci/[email protected] in 42821ms
Full job output if needed https://github.com/DataDog/test-infra-definitions/actions/runs/10450688362/job/28935553314.
It was installed in /home/runner/go/bin/golangci-lint
but was detected as github.com/golangci/[email protected]
.
This is due to the logic not expecting the first line
golangci-lint-action/src/install.ts
Lines 103 to 106 in de85310
Changing the version in my go.mod
file from 1.22.0 to 1.22 fixed it, but I believe the path should be correctly parsed by the action.
Version of golangci-lint
1.60.1
Version of the GitHub Action
v6 (latest)
Workflow file
# Optional: golangci-lint command line arguments.
args: --timeout=10m
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
# Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
install-mode: "goinstall"
</details>
### Golangci-lint configuration
<details>
```yml
run:
timeout: 5m
linters:
disable-all: true
enable:
- unused # Finds unused code
- unconvert # Remove unnecessary type conversions
- unused # Checks Go code for unused constants, variables, functions and types
- ineffassign # Detects when assignments to existing variables are not used
- misspell # Finds commonly misspelled English words in comments
- gofmt # Gofmt checks whether code was gofmt-ed
- revive # Revive is a replacement for golint, a coding style checker
- errcheck # errcheck is a program for checking for unchecked errors in go programs.
- staticcheck # staticcheck is a go vet on steroids, applying a ton of static analysis checks
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- bodyclose # checks whether HTTP response body is closed successfully
- exhaustive # check exhaustiveness of enum switch statements
- stylecheck # Stylecheck is a replacement for golint
linters-settings:
errcheck:
# Disable warnings for `fmt` and `log` packages.
exclude-functions:
- fmt.Errorf
- fmt.Print
- fmt.Printf
- fmt.Println
- (github.com/pulumi/pulumi/sdk/v3/go/pulumi.Log).Debug
- (github.com/pulumi/pulumi/sdk/v3/go/pulumi.Log).Info
- (github.com/pulumi/pulumi/sdk/v3/go/pulumi.Log).Warn
- (github.com/pulumi/pulumi/sdk/v3/go/pulumi.Log).Error
staticcheck:
checks: ["all"]
Go version
1.22.0
Code example or link to a public repository
// add your code here