Skip to content

Broken multi go.mod workspace #2243

Closed
Closed
@sbstp

Description

@sbstp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions