Skip to content

Broken multi go.mod workspace #2243

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

Closed
sbstp opened this issue May 13, 2022 · 3 comments
Closed

Broken multi go.mod workspace #2243

sbstp opened this issue May 13, 2022 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@sbstp
Copy link

sbstp commented May 13, 2022

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.18 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.

    •   da15b6fd3ef856477bf6f4fb29ba1b7af717770d
        x64
  • Check your installed extensions to get the version of the VS Code Go extension

    • v0.33.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

    •   GOBIN: undefined
        toolsGopath: 
        gopath: /home/simon/go
        GOROOT: /opt/go
        PATH: /opt/go/bin:/home/simon/.local/bin:/home/simon/.cargo/bin:/home/simon/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/simon/.dotnet/tools:/home/simon/go/bin:/home/simon/go/bin
        PATH (vscode launched with): /opt/go/bin:/home/simon/.local/bin:/home/simon/.cargo/bin:/opt/go/bin:/home/simon/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/simon/.dotnet/tools:/home/simon/go/bin:/home/simon/go/bin
      
        	go:	/opt/go/bin/go: go version go1.18 linux/amd64
      
        	gotests:	/home/simon/go/bin/gotests	(version: v1.6.0 built with go: go1.18)
        	gomodifytags:	/home/simon/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.18)
        	impl:	/home/simon/go/bin/impl	(version: v1.1.0 built with go: go1.18)
        	goplay:	/home/simon/go/bin/goplay	(version: v1.0.0 built with go: go1.18)
        	dlv:	/home/simon/go/bin/dlv	(version: v1.8.3 built with go: go1.18)
        	staticcheck:	/home/simon/go/bin/staticcheck	(version: v0.3.1 built with go: go1.18)
        	gopls:	/home/simon/go/bin/gopls	(version: v0.8.3 built with go: go1.18)
      
        go env
        Workspace Folder (salesforce): /home/simon/projects/nesto/backend/salesforce
        	GO111MODULE=""
        	GOARCH="amd64"
        	GOBIN=""
        	GOCACHE="/home/simon/.cache/go-build"
        	GOENV="/home/simon/.config/go/env"
        	GOEXE=""
        	GOEXPERIMENT=""
        	GOFLAGS=""
        	GOHOSTARCH="amd64"
        	GOHOSTOS="linux"
        	GOINSECURE=""
        	GOMODCACHE="/home/simon/go/pkg/mod"
        	GONOPROXY="github.com/nestoca"
        	GONOSUMDB="github.com/nestoca"
        	GOOS="linux"
        	GOPATH="/home/simon/go"
        	GOPRIVATE="github.com/nestoca"
        	GOPROXY="https://proxy.golang.org,direct"
        	GOROOT="/opt/go"
        	GOSUMDB="sum.golang.org"
        	GOTMPDIR=""
        	GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
        	GOVCS=""
        	GOVERSION="go1.18"
        	GCCGO="gccgo"
        	GOAMD64="v1"
        	AR="ar"
        	CC="gcc"
        	CXX="g++"
        	CGO_ENABLED="1"
        	GOMOD="/dev/null"
        	GOWORK="/home/simon/projects/nesto/backend/salesforce/go.work"
        	CGO_CFLAGS="-g -O2"
        	CGO_CPPFLAGS=""
        	CGO_CXXFLAGS="-g -O2"
        	CGO_FFLAGS="-g -O2"
        	CGO_LDFLAGS="-g -O2"
        	PKG_CONFIG="pkg-config"
        	GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3049096489=/tmp/go-build -gno-record-gcc-switches"
        	```
      

Share the Go related settings you have added/edited

    "gopls": {
        "experimentalWorkspaceModule": true,
    },
    "go.toolsManagement.autoUpdate": true,

Describe the bug

Warnings in every file complaining about not being able to find imports, warnings on the field saying they are undefined. Editor is pretty much unusable.

We have a project with two go.mod files, we have a a folder called api and a folder called integration/tests in the project folder. Both of these have a go.mod in them. For about 10 months of so this setup was working perfectly with the experimentalWorkspaceModule option. About a month or two ago these errors started occuring. I was hoping it was just a temporary error so I switched to using GoLand for a month or two hoping it would get fixed, but it still hasn't been fixed so I'm taking the time to open a ticket now.

I have tried clearing the cache, modcache, testcache, does not help.

Steps to reproduce the behavior:

I can't share out proprietary codehbase of course, so I recreated a dummy repo here with the same structure as our proprietary repo. I'm not able to replicate the error in the dummy repo at the moment. So it might not be that useful sadly.

Screenshots or recordings

image

@gopherbot gopherbot added this to the Untriaged milestone May 13, 2022
@findleyr
Copy link
Member

Hi, since you're using go 1.18, can you please try removing the experimentalWorkspaceModule setting and just using a go.work file as described here?

@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 13, 2022
@sbstp
Copy link
Author

sbstp commented May 13, 2022

Seems to address the issue, thank you.

@findleyr
Copy link
Member

Great, thanks for confirming!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants