-
Notifications
You must be signed in to change notification settings - Fork 645
Proposal: Option to not show lint errors if there are build errors #600
Comments
What are your thoughts on running |
I think that would be fine. A quick test seems to indicate that return &Result{foo}, nil
|
We won't be serializing the build and lint process. They run in parallel at the moment. What we can do is add an option to show linting errors only if there are no build errors. I'd like to see if there are more people interested in this feature. Our settings list is growing big real fast. |
Heavy vscode user, light go plugin user. |
Looks like this issue is dead. I tried enabling some more linters — I had disabled Just to reiterate, it seems nonsensical to offer a lint error (green squiggle) if a line also has a syntax error (red squiggle). Here's me hitting the "next marker" key to cycle: How does (2/2) help me here? The line contains a syntax error and the linting error probably can't be correct. (And it isn't. When linters encounter build errors, they emit them as linter errors, so this is a false positive.) My suggested fix is to ignore linter errors for lines that already have error markers on them. That will almost completely fix this problem. There's still the chance that false-positive linter errors can appear on other lines that aren't build errors, but I don't think that will be as damaging. |
Now that's something I can do :) Will get it out for the next update |
@atombender I have pushed the changes to master, can you help with testing? All you have to do is
|
@ramya-rao-a Thanks, sorry about the delay. Love the new behaviour. However, I also notice that error markers don't show up until Gometalinter has finished running, which, as you know, can take a while. (I've tried disabling the slowest linters, but it's still very resource-intensive.) In my opinion, with this new behaviour, there's no point in waiting for Gometalinter, since it won't override any of the error markers. |
@ramya-rao-a The change caused format-on-save to no longer happen. I have |
I just rebooted, and after this, VSCode is now linting Go itself!
I've verified that Gometalinter is run from the right directory. If I |
That's weird. There was no changes made to how the linter is run. The changes were only made to how we treat the results from the linter. |
About the formatting, we are deprecating
|
Got it, thanks. |
I just installed the |
Ok, you gave me quite a scare there :) |
@ramya-rao-a Ugh, it happened again, and I figured out why. It turns out VSCode is (sometimes!) sets |
The Go extension doesn't touch the $PATH If you have set the |
Is there another explanation for why |
Yes, please create a new issue. |
In the latest update to the Go extension (0.6.70), linting/vetting errors will not show up on a line that has build errors |
Here's an annoying problem. Say you have this:
If you run
gometalinter
with all linters enabled, this will get a bunch of errors/warnings.cannot use foo (type string) as type int in field value
ineffectual assignment to foo (ineffassign)
error return value not checked (foo declared but not used) (errcheck)
error return value not checked (cannot use foo (variable of type string) as int value in struct literal) (errcheck)
It's possible to get even more false positives — for example, if you call a function that ends up not being called because of the build error error, that will trigger the
deadcode
linter.The only real error here is this one:
Dropping these linter errors into the mix serves to obscure the real error; I use "jump to next marker" to find the next error to fix, but since they're intermingled, it's initially hard to see what to fix, especially when there are multiple errors on the same line (which is true in the above example).
VSCode underlines build errors with a red squiggle, as opposed to green for linter errors, but I have also seen cases where there are only linter errors. Here's one:
That's an actual build error, but it only has a green squiggle (latest vscode-go, 1.7.1).
My proposal is to build first, and don't run any linters if there are build errors. This will also speed up responsiveness to actual syntax errors, since only a build is needed initially. (It might be good to make this an optional setting, though.)
The text was updated successfully, but these errors were encountered: