-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/gopls: don't show analysis for std and 3rd-party packages #45607
Comments
I'm not sure there's a clear answer here, though I agree that in the example above I wouldn't want to see analysis for gorilla/mux. I think this becomes more clear-cut once multi-module workspaces are the norm. At that point we'll know which modules the user is intending to work on. |
Maybe make it optional through the |
We can consider that, but we'd need evidence that two users, when working on the same exact workspace, might reasonably want different behavior. I.e., that such configuration is not just papering over gopls' inability to determine the user's intent with respect to a given package. In the past we've used configuration when we can't just Do The Right Thing, resulting in configuration bloat and suboptimal behavior in the common zero-config case (I've been guilty of this). In this case, my sense is that users only want to see lint errors when they're actionable. A lint error in a read-only module is not actionable. |
True, but we also have:
Both of these are usually RW, thus actionable (maybe not every time and not in the case of /vendor, but it's possible). |
Indeed, though I would argue we also shouldn't run analyzers for vendored packages. To be more precise, though, we should differentiate between running an analyzer and showing the diagnostics. In some cases we may want to run analyzers on all dependencies in order to compute facts. Perhaps the rule should be "only show analysis diagnostics for workspace packages and locally replaced packages". |
Should I change the title to |
If that would satisfy your original request, then yes :) I've updated the title with a slight variation of that. |
We chatted about this request in a meeting today, and some team members like seeing all diagnostics, even if they aren't actionable. I guess, per my criteria above, this means it probably should be a configuration gated feature (something like Given that the current state is preferable for some users and mildly annoying for others, this is unlikely to be prioritized soon. |
See also golang/vscode-go#1275. Perhaps the setting should be more fine grained: something like Where Frankly there's a lot of overlap with a more general request we've had to limit the scope of certain features to open packages only, for large monorepos. @heschi has been thinking about this. |
Warning in
/src/os/exec_unix.go
:Warning in
github.com/gorilla/[email protected]/mux.go
:I think these warnings are not useful, but just distracting. It makes sense to run analyzers only for workspace packages
The text was updated successfully, but these errors were encountered: