x/tools/gopls: detect tools.go files, and suppress warning #69072
Labels
gopls/analysis
Issues related to running analysis in gopls
gopls
Issues related to the Go language server, gopls.
help wanted
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
I've been looking for a way to fix this for quite a bit of time and nothing I've tried has worked. I'm using
oapi-codegen
to generate boilerplate for my webserver. The authors of this library recommend the tools.go pattern for managing the dependency, so thatgo.mod
can act as the single source of truth for versioning. For transparency, their readme recommends this here. Doing this actually works -- I can rungo generate
just fine and my code builds. However, VSCode insists on showing an error and warning in this tools.go file, marking the file and the module folder red:This is driving me crazy. I'd like to at least suppress these, but I can't find any way to do so. I've tried using the
lintFlags
to exclude it, but it appears to begopls
and notstaticcheck
, so this doesn't do anything. I can't find agopls
configuration setting that will allow me to ignore this file or any issues with it, either.For what it's worth, someone else noticed the same thing with a different library in this issue.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
The text was updated successfully, but these errors were encountered: