You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
goplsIssues related to the Go language server, gopls.QuestionIssues that are questions about using Go.ToolsThis label describes issues relating to any tools in the x/tools repository.
Then generate wire_gen.go through the wire command, which will contain the following custom tag
//go:build !wireinject
// +build !wireinject
What did you see happen?
gopls cannot analyze the code in wire.go file. The error message is as follows
No packages found for open file /path/to/wire.go.
This file may be excluded due to its build tags; try adding "-tags=<build tag>" to your gopls "buildFlags" configuration
See the documentation for more information on working with build tags:
https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags.go list
What did you expect to see?
I hope gopls can automatically parse the wire.go file correctly
I have tried searching for answers, and there are answers that point out that buildFlags can be added to gopls to support the wireinject compilation tag
But when doing this, I will encounter another problem. Gopls will not be able to parse the wire_gen.go file because it contains the opposite !wireinject tag
Sorry, I have tried searching but have not found an effective way to support the parsing of these two opposite tags at the same time. Can anyone tell me the correct answer?
Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Luna-CY
added
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
labels
Feb 7, 2025
goplsIssues related to the Go language server, gopls.QuestionIssues that are questions about using Go.ToolsThis label describes issues relating to any tools in the x/tools repository.
gopls version
gopls version
golang.org/x/tools/gopls v0.17.1
go env
What did you do?
Add a file
wire.go
Add the following custom build tag
Then generate
wire_gen.go
through thewire
command, which will contain the following custom tagWhat did you see happen?
gopls cannot analyze the code in
wire.go
file. The error message is as followsWhat did you expect to see?
I hope gopls can automatically parse the wire.go file correctly
I have tried searching for answers, and there are answers that point out that buildFlags can be added to gopls to support the
wireinject
compilation tagBut when doing this, I will encounter another problem. Gopls will not be able to parse the
wire_gen.go
file because it contains the opposite!wireinject
tagSorry, I have tried searching but have not found an effective way to support the parsing of these two opposite tags at the same time. Can anyone tell me the correct answer?
Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered: