Open ChristoWolf opened 1 year ago
I think the problem is your "buildFlags" setting. It looks like you are trying to set the "integration" build tag, but in that case it should be "-tags=integration".
It looks like gopls is passing the build flags unmodified to the go command, and that's why "-e" (which is probably passed after build tags) is interpreted as a non-flag argument.
This is messy, and we should validate build flags to produce a better error.
@findleyr: Thanks for the quick reply!
That was of course also my first thought, but when I first encountered the issue I tried to disable the buildFlags
, but it did not fix the issue.
Now with your reply I tried it out again and also restarted VS Code (and by that also gopls) and it worked.
So that was just a false positive from my side.
Anyway, your answer helped me resolve my issue, thanks a ton!
This is messy, and we should validate build flags to produce a better error.
I think that would be quite helpful! One could also argue that the current error message is already telling (I mean, it was, because we both already knew what the cause could be), but improving it would certainly improve the experience.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.19.5 windows/amd64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - golang.org/x/tools/gopls v0.11.0 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.74.3 97dec172d3256f8ca4bfb2143f3f76b503ca0534 x64 * Check your installed extensions to get the version of the VS Code Go extension - v0.37.1 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. - ``` Workspace Folder (devTools): c:\dev\devTools set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\cwolf\AppData\Local\go-build set GOENV=C:\Users\cwolf\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\cwolf\go\pkg\mod set GONOPROXY=redacted set GONOSUMDB=redacted set GOOS=windows set GOPATH=C:\Users\cwolf\go set GOPRIVATE=redacted set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.19.5 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=NUL set GOWORK=c:\dev\devTools\go.work set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\cwolf\AppData\Local\Temp\go-build1196747904=/tmp/go-build -gno-record-gcc-switches ``` I also had `GOWORK=` before, but that led to the same issue.
Share the Go related settings you have added/edited
Describe the bug
A clear and concise description of what the bug is:
In my workspace folder I have a
go.work
file containing my relative module paths in that folder. Still, I get the following persistent error notification:I have no idea why these are being probed, because they do not exist at all and are not referenced anywhere. The ones with hyphens do not even make sense of course. The
integration
is also not a package but ago:build
flag that I have at the top of a test file, which works as expected.Further, when I set
all modules inside the workspace folder are marked as red because the error above is shown inside the mod files, and the notification still persists.
The
gopls (server)
OUTPUT
shows:Either way, everything builds and runs as expected despite these issues.
A clear and concise description of what you expected to happen.
That no non-existent packages/modules are tried to be loaded.
Steps to reproduce the behavior:
gopls (server)
OUTPUT
.