Commit 2ec30b0
committed
pkg/goanalysis: expose underlying errors
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.1 parent 374a8cf commit 2ec30b0
1 file changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
244 | 269 | | |
245 | 270 | | |
246 | 271 | | |
| |||
0 commit comments