Skip to content

Conversation

kevinburkesegment
Copy link

@kevinburkesegment kevinburkesegment commented Sep 5, 2025

If compilation or building of a Go package fails, export data will not be available. Previously, we would mask the underlying failure and display only a message that "no export data" was available. This has led to lots of confusion among golangci-lint users (and users at my company, which is how I discovered this problem).

#3996, #4630, #4912, #4964, #5037, #5051, #5184, #5428, #5437

In addition to numerous discussions. The only common thread between the responses to these discussions, is that the "no export data" error message is obscuring whatever the underlying problem is, and making it more difficult to troubleshoot.

#2489, #2191, #2751, #3363, #4829, #4880

This fix simply walks the import tree and appends any found error messages to the "no export data" error message. This will make it much clearer for end users to discover the problem that is causing the linter to fail.

Example output:

ERRO Running error: can't run linter goanalysis_metalinter
inspect: failed to load package errs: could not load export data: no export data for "github.com/segmentio/ctlstore/pkg/errs" because of error in imported package(s): error in package "github.com/segmentio/stats/v5": # github.com/segmentio/stats/v5
vendor/github.com/segmentio/stats/v5/tag.go:38:35: in call to slices.IsSortedFunc, type func(a Tag, b Tag) int of tagCompare does not match inferred type func(a Tag, b Tag) bool for func(a E, b E) bool

Fixes #6056

If compilation or building of a Go package fails, export data will not
be available. Previously, we would mask the underlying failure and
display only a message that "no export data" was available. This has
led to lots of confusion among golangci-lint users (and users at my
company, which is how I discovered this problem).

golangci#3996
golangci#4630
golangci#4912
golangci#4964
golangci#5037
golangci#5051
golangci#5184
golangci#5428
golangci#5437

In addition to numerous discussions. The only common thread between
the responses to these discussions, is that the "no export data" error
message is obscuring whatever the underlying problem is, and making it
more difficult to troubleshoot.

golangci#2489
golangci#2191
golangci#2751
golangci#3363
golangci#4829
golangci#4880

This fix simply walks the import tree and appends any found error
messages to the "no export data" error message. This will make it much
clearer for end users to discover the problem that is causing the
linter to fail.

Example output:

    ERRO Running error: can't run linter goanalysis_metalinter
    inspect: failed to load package errs: could not load export data: no export data for "github.com/segmentio/ctlstore/pkg/errs" because of error in imported package(s): error in package "github.com/segmentio/stats/v5": # github.com/segmentio/stats/v5
    vendor/github.com/segmentio/stats/v5/tag.go:38:35: in call to slices.IsSortedFunc, type func(a Tag, b Tag) int of tagCompare does not match inferred type func(a Tag, b Tag) bool for func(a E, b E) bool

Fixes golangci#6056.
@ldez ldez closed this Sep 5, 2025
@ldez ldez added the declined label Sep 5, 2025
@golangci golangci locked and limited conversation to collaborators Sep 5, 2025
@golangci golangci unlocked this conversation Sep 5, 2025
@ldez ldez removed the declined label Sep 5, 2025
@ldez ldez reopened this Sep 5, 2025
@ldez ldez added the enhancement New feature or improvement label Sep 5, 2025
@ldez ldez added this to the v2-unreleased milestone Sep 5, 2025
@ldez
Copy link
Member

ldez commented Sep 6, 2025

Closed in favor of #6061

@ldez ldez closed this Sep 6, 2025
@ldez ldez added declined and removed enhancement New feature or improvement labels Sep 6, 2025
@ldez ldez removed this from the v2-unreleased milestone Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"no export data": clearer error message
2 participants