Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

failed to load package alltransports: could not load export data: no export data for \"github.com/containers/image/v5/transports/alltransports\""#1239

Answeredbyldez
schlesh asked this question inQ&A
Discussion options

I’m encountering an issue running golangci-lint in one of my repositories. The linter fails with the following error:

can't run linter goanalysis_metalinterinspect: failed to load package alltransports: could not load export data: no export data for "github.com/containers/image/v5/transports/alltransports"Error: golangci-lint exit with code 3

What I’ve Tried:
•Verified the issue is isolated to this repository—other repos using the same config and workflow are working fine.
•Attempted to exclude goanalysis_metalinter, but doing so causes another error saying the linter does not exist.
•Tried excluding all paths to isolate the problem, but the lint still fails.
•I've attempted running golangci-lint from with the CLI command in my action and get the same result.
•Confirmed that go mod tidy, go mod download, and go mod verify complete without errors before linting.

Configuration:

I’m using a shared .golangci.yaml configuration and running the linter via GitHub Actions. Here’s a minimal version of my setup:

.golangci.yaml
version:"2"run:tests:falsemodules-download-mode:readonlytimeout:10missues-exit-code:1linters:default:fastenable:    -errcheck    -govet    -ineffassign    -staticcheck    -unused    -misspell    -gosec    -revive    -preallocsettings:errcheck:check-type-assertions:truemisspell:locale:USformatters:enable:    -gofmt    -goimportssettings:gofmt:simplify:falserewrite-rules:        -pattern:interface{}replacement:any        -pattern:a[b:len(a)]replacement:a[b:]
GitHub Action Step
-name:Run golangci-lintuses:golangci/golangci-lint-action@v8with:version:latestargs:--verboseconfig:.golangci.yamlverify:true

Environment:

  • Go version: 1.24
  • golangci-lint action: v8
  • Modules are correctly resolved via a private access token and go mod steps succeed.

Request for Help:

I’m not sure how to resolve the "no export data" issue or how to properly exclude goanalysis_metalinter if it’s not explicitly declared in the config. Any insights into the cause of this error or suggestions for a workaround would be greatly appreciated.

You must be logged in to vote
Answered by ldezMay 21, 2025

The modulegithub.com/containers/image/v5 depends ongithub.com/containers/storage, and this module (github.com/containers/storage) uses cgo, so some system dependencies are required.

btrfs seems not available inside GitHub action environments.

You should add the following lines inside your workflow file:

jobs:lint:runs-on:ubuntu-latestenv:# <-----CGO_ENABLED:0# <-----

https://github.com/ldez/schlesh-golangci-lint-example/blob/cf91acb93957391f6557e3112d1ddf5c0521a74b/.github/workflows/go_lint.yaml#L12-L13

Replies: 1 comment 10 replies

Comment options

ldez
May 21, 2025
Maintainer

I’m not sure how to resolve the "no export data" issue

The problem is related to your project, my guess is a problem with your go.mod/go.sum, or build tags.

how to properly exclude goanalysis_metalinter

goanalysis_metalinter is not a real linter, this is an internal structure to wraps analyzers (linters) then it cannot be excluded.

You must be logged in to vote
10 replies
@ldez
Comment options

ldezMay 21, 2025
Maintainer

Do you have a minimum reproducible example?

If not, this is a sign that the problem is how your project environment is set up inside your CI.
As you are using a private module, my guess is related to your dependencies (the go.mod/go.sum), so you have to check the requirements of your project environment inside your CI.

@schlesh
Comment options

Sorry for the delay. I put together this repo to demonstrate and was able to reproduce the issue.

https://github.com/schlesh/golangci-lint-example

run golangci-lint  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint config path] in [/home/runner/work/golangci-lint-example/golangci-lint-example] ...  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint config verify] in [/home/runner/work/golangci-lint-example/golangci-lint-example] ...  Running [/home/runner/golangci-lint-2.1.6-linux-amd64/golangci-lint run  --verbose] in [/home/runner/work/golangci-lint-example/golangci-lint-example] ...  level=info msg="golangci-lint has version 2.1.6 built with go1.24.2 from eabc2638 on 2025-05-04T15:41:19Z"  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/golangci-lint-example/golangci-lint-example /home/runner/work/golangci-lint-example /home/runner/work /home/runner /home /]"  level=info msg="[config_reader] Used config file .golangci.yaml"  level=info msg="[config_reader] Module name \"golangci-lint-example\""  level=info msg="maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined"  level=info msg="[goenv] Read go env for 2.705717ms: map[string]string{\"GOCACHE\":\"/home/runner/.cache/go-build\", \"GOROOT\":\"/opt/hostedtoolcache/go/1.24.3/x64\"}"  level=info msg="[lintersdb] Active 51 linters: [asciicheck bidichk copyloopvar cyclop decorder depguard dogsled dupl dupword errcheck funcorder funlen gocheckcompilerdirectives gochecknoinits gocognit gocyclo godot godox gofmt goheader goimports gomoddirectives gomodguard goprintffuncname gosec govet grouper inamedparam ineffassign interfacebloat lll maintidx misspell mnd nakedret nestif nlreturn nolintlint nosprintfhostport prealloc predeclared promlinter revive staticcheck tagalign testableexamples testpackage unused usestdlibvars whitespace wsl]"  level=info msg="[loader] Go packages loading at mode 8767 (deps|exports_file|files|compiled_files|imports|name|types_sizes) took 18.240936878s"  level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 131.868µs"  level=info msg="[linters_context/goanalysis] analyzers took 15.123444355s with top 10 stages: buildir: 12.851117053s, inspect: 444.801576ms, fact_deprecated: 413.738275ms, printf: 355.950636ms, fact_purity: 277.887157ms, ctrlflow: 275.914943ms, nilness: 191.038412ms, SA5012: 133.70933ms, typedness: 116.675277ms, tokenfileanalyzer: 59.128716ms"  level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package alltransports: could not load export data: no export data for \"github.com/containers/image/v5/transports/alltransports\""  level=info msg="[runner] processing took 3.168µs with stages: max_same_issues: 631ns, exclusion_paths: 351ns, exclusion_rules: 240ns, max_from_linter: 211ns, source_code: 180ns, path_absoluter: 180ns, max_per_file_from_linter: 170ns, diff: 161ns, nolint_filter: 161ns, sort_results: 150ns, filename_unadjuster: 150ns, path_prettifier: 141ns, path_relativity: 80ns, generated_file_filter: 60ns, invalid_issue: 60ns, uniq_by_line: 51ns, cgo: 51ns, fixer: 50ns, severity-rules: 50ns, path_shortener: 40ns"  level=info msg="[runner] linters took 5.642541948s with stages: goanalysis_metalinter: 5.642487185s"  level=error msg="Running error: can't run linter goanalysis_metalinter\ninspect: failed to load package alltransports: could not load export data: no export data for \"github.com/containers/image/v5/transports/alltransports\""  level=info msg="Memory: 239 samples, avg is 125.8MB, max is 554.4MB"  level=info msg="Execution took 23.886832303s"
@ldez
Comment options

ldezMay 21, 2025
Maintainer

https://github.com/ldez/schlesh-golangci-lint-example/actions/runs/15173489891/job/42668950150

$ go run .# github.com/containers/storage/drivers/btrfsError: ../../../go/pkg/mod/github.com/containers/storage@v1.58.0/drivers/btrfs/version.go:6:10: fatal error: btrfs/version.h: No such file or directory    6 | #include <btrfs/version.h>      |          ^~~~~~~~~~~~~~~~~compilation terminated.Error: Process completed with exit code 1.
@ldez
Comment options

ldezMay 21, 2025
Maintainer

The modulegithub.com/containers/image/v5 depends ongithub.com/containers/storage, and this module (github.com/containers/storage) uses cgo, so some system dependencies are required.

btrfs seems not available inside GitHub action environments.

You should add the following lines inside your workflow file:

jobs:lint:runs-on:ubuntu-latestenv:# <-----CGO_ENABLED:0# <-----

https://github.com/ldez/schlesh-golangci-lint-example/blob/cf91acb93957391f6557e3112d1ddf5c0521a74b/.github/workflows/go_lint.yaml#L12-L13

Answer selected byschlesh
@schlesh
Comment options

Thank you will report back with results.

@ldez
Comment options

ldezMay 21, 2025
Maintainer

another possibility is to installbtrfs devel files:

steps:      -name:install CGO dependenciesrun:sudo apt-get install libbtrfs-dev -y

https://github.com/ldez/schlesh-golangci-lint-example/blob/67196c933f51e9721ce5bf9beeb85e20dad6283e/.github/workflows/go_lint.yaml#L16-L17

$docker run --rm -v$(pwd):/app -w /app -it golang:1.24 bashroot@c62dcb2bdc90:/app#go mod downloadroot@c62dcb2bdc90:/app#go run.#github.com/containers/storage/drivers/btrfs/go/pkg/mod/github.com/containers/storage@v1.58.0/drivers/btrfs/version.go:6:10: fatal error: btrfs/version.h: No such file or directory    6 | #include <btrfs/version.h>      |          ^~~~~~~~~~~~~~~~~compilation terminated.root@c62dcb2bdc90:/app#apt update&& apt -y upgrade...root@c62dcb2bdc90:/app#apt-get install libbtrfs-dev -yReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following additional packages will be installed:  libbtrfs0The following NEW packages will be installed:  libbtrfs-dev libbtrfs00 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.Need to get 106 kB of archives.After this operation, 325 kB of additional disk space will be used.Get:1 http://deb.debian.org/debian bookworm/main amd64 libbtrfs0 amd64 6.2-1+deb12u1 [35.2 kB]Get:2 http://deb.debian.org/debian bookworm/main amd64 libbtrfs-dev amd64 6.2-1+deb12u1 [70.7 kB]Fetched 106 kB in 0s (3131 kB/s)debconf: delaying package configuration, since apt-utils is not installedSelecting previously unselected package libbtrfs0:amd64.(Reading database ... 15609 files and directories currently installed.)Preparing to unpack .../libbtrfs0_6.2-1+deb12u1_amd64.deb ...Unpacking libbtrfs0:amd64 (6.2-1+deb12u1) ...Selecting previously unselected package libbtrfs-dev:amd64.Preparing to unpack .../libbtrfs-dev_6.2-1+deb12u1_amd64.deb ...Unpacking libbtrfs-dev:amd64 (6.2-1+deb12u1) ...Setting up libbtrfs0:amd64 (6.2-1+deb12u1) ...Setting up libbtrfs-dev:amd64 (6.2-1+deb12u1) ...Processing triggers for libc-bin (2.36-9+deb12u10) ...root@c62dcb2bdc90:/app#go run.Parsed image transport: dockerroot@c62dcb2bdc90:/app#
@schlesh
Comment options

Thank you the solution above worked like a charm. I'll go back and check the secondary solution in a bit and report back.

@ldez you're the GOAT.

@ldez
Comment options

ldezMay 21, 2025
Maintainer

I hope you enjoyed my work, Please consider donating or asking your company to do so.
This will be appreciated, thank you ❤️

https://donate.golangci.org/
https://donate.ldez.dev/

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@schlesh@ldez

[8]ページ先頭

©2009-2025 Movatter.jp