I'm using the GitHub action https://github.com/golangci/golangci-lint-action
I'm getting the error:
Installed golangci-lint into /home/runner/golangci-lint-1.43.0-linux-amd64/golangci-lint in 458ms
Prepared env in 606ms
run golangci-lint
Running [/home/runner/golangci-lint-1.43.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.9()
github.com/go-critic/[email protected]/checkers/checkers.go:58 0x4b4
Error: golangci-lint exit with code 2
Ran golangci-lint in 13383ms
Which is a known issue for golangci-lint
with golang v1.18.0 https://github.com/golangci/golangci-lint/issues/2374
My GitHub action file is:
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
permissions:
contents: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43
I've also tried to use:
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
permissions:
contents: read
jobs:
golangci:
strategy:
matrix:
go-version: [1.17.x]
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43
But both are failing, what can I do in that case?
I have open this issue in the project, in case it helps https://github.com/golangci/golangci-lint-action/issues/442
CodePudding user response:
Bumping golangci/golangci-lint-action, actions/setup-go, and actions/checkout to v3 did the trick for me.