-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve compilation errors output #1859
Conversation
ce5b910
to
6fe0d05
Compare
Wow, awesome job! Does typecheck list all compilation errors by being run first? If so, this pretty much solves all issues asking for this! |
FYI golangci-lint/pkg/golinters/typecheck.go Lines 14 to 16 in 8db518c
The real code is here: golangci-lint/pkg/golinters/goanalysis/linter.go Lines 180 to 216 in 8db518c
Currently, I try to handle a side effect of using |
I think that I found the "ultimate" fix 🎉 But for that, I will reorganize the code without any changes, and after I will fix the core problem. My plan:
Maybe I will create another PR 🤔 |
Superseded by #1861 |
Fixes #1002
Related to #1820 and #886
I think this also fixes partially #1792 (#1792 (comment))
This PR will improve in the report when the analyzed code contains compilation errors.
It's a bit complex to explain but I will try to explain it.
typecheck
is like the front-end of a Go compiler, parses and type-checks Go code.This linter is able to manage compilation error, that's his role.
So this linter must be the first linter.
To put
typecheck
as the first linter, I improved the sort of the linters insideenabled_set.go
and I changed the load mode togoanalysis.LoadModeWholeProgram
(because the linters withgoanalysis.LoadModeWholeProgram
are not put inside the metalinter and they are executed before the metalinter)This change will not improve the output when only one linter is launched, it's another topic.
But I think that the output will be better in 90% of the use-cases: when several linters (including
typecheck
) are runBefore my PR
With my PR