golangci-lint-action: [Error] Can't run linter goanalysis_metalinter: buildir
I found error suddenly due to go1.18 issue Then I tried to change configuration followed by the above issue, another error as title happened after configuration changed.
Errors are
run golangci-lint
Running [/home/runner/golangci-lint-1.45.2-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=cmds/alpha] in [/home/runner/work/org/my-repo/cmds/alpha] ...
level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for \"io/fs\""
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for \"io/fs\"\n\n"
configuration
golangci:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.17]
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- name: golangci-lint for alpha cmds
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
working-directory: cmds/alpha
difference from most of common use is I’m using monorepo and I use working-directory. I’m not sure .golangcli.yaml stored in root directory is used properly in this version, thought it used to be work.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (1 by maintainers)
getting this issue as well both locally and in ci workflow
Fwiw, in my case, the same issue was caused by depending on a private repository and solved by following the steps here: https://blog.fabianmendez.dev/how-to-use-private-go-module-in-github-actions
For me it was malformed go dependencies made it tidy:
go mod tidyIve just noticed this happening to me both on ci and locally.
i believe in your case go-webp is dependent on some third party binary that is not by default installed on local machine nor the gb action runner. As their github page states: (https://github.com/kolesa-team/go-webp)
Requirements - libwebp
You have to add preliminary step in you action that will install this dependency before running lint. Go needs to be able to compile your code and it needs all dependencies to do so.
Upgrading the
golangci-lintversion fixed the problem for me.brew upgrade golangci-lintmy golangci-lint version was 1.50.1 and my go version was: go version go1.18.1 darwin/arm64
not effect
I also faced this issue with this workflow.
This is a basic workflow to help you get started with Actions
name: Linting and Static Code Analysis
on: [push, pull_request]
jobs: golangci: name: lint
Later I updated the golangci-lint version to v1.46.2 (latest one)
And it worked. I guess this issue can be resolved.