Skip to content
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

x/tools/gopls: multi-modules workspace fails with v2+ private module #41807

Closed
pierrre opened this issue Oct 6, 2020 · 2 comments
Closed

x/tools/gopls: multi-modules workspace fails with v2+ private module #41807

pierrre opened this issue Oct 6, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@pierrre
Copy link

@pierrre pierrre commented Oct 6, 2020

What version of Go are you using (go version)?

➜  ~ go version
go version go1.15.2 linux/amd64
➜  ~ gopls version
golang.org/x/tools/gopls v0.5.1
    golang.org/x/tools/gopls@v0.5.1 h1:AF3Uh7HF08SZpKFfgJO6zfF3bbxyDXWqdkK4kMXiQ1o=

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pierre/.cache/go-build"
GOENV="/home/pierre/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pierre/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pierre/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/pierre/.gimme/versions/go1.15.2.src"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/pierre/.gimme/versions/go1.15.2.src/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build972067898=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm using vscode and I've enabled the multi-modules workspace experimental option.
My configuration:

	"gopls": {
		"usePlaceholders": true,
		"codelens": {
			"gc_details": true
		},
		"experimentalWorkspaceModule": true
	},

I've opened with vscode a directory containing all my private (Github projects).
Some of these projects are "v1" and some of them are "v2+".
The go.mod of my "v2+" projects are properly configured, and the module correctly shows the same major version.
They are "normal" small projects, not a monorepo.

I've configured my global ~/.gitconfig with:

[url "https://xxxxxxxx@github.com/"]
        insteadOf = https://github.com/

(it was working fine previously anyway)

What did you expect to see?

gopls should work.

What did you see instead?

gopls fails to initialize, and prints this message:

/tmp/gopls-mod558442027/go.mod:32:2: require github.com/xxx/yyy/v2: version "v0.0.0-goplsworkspace" invalid: unknown revision v0.0.0-goplsworkspace

It fails in 2 cases:

  • there is a "v2+" project in my directory
  • there is a "v1" project in my directory importing one of my "v2+" project

Removing all "faulty" projects fixes the issue.

It was working fine with the previous workflow:

  • create an empty workspace
  • add to the workspace all the directories of my projects

But this previous workflow is consuming a lot of RAM (gopls).
So it's not sustainable on the long term.
The more projects I had, the more memory it uses.
I've got ~70 projects, and I need to open them all.
With the new multi-modules workspace, my memory usage is decreased by 10x ! 👍

@gopherbot gopherbot added this to the Unreleased milestone Oct 6, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.2 Oct 6, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 6, 2020

Thank you for this report and for trying out the experimental mode :)
This is definitely a bug--we'll look into fixing it for the next release.

@stamblerre stamblerre self-assigned this Oct 7, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 7, 2020

Change https://golang.org/cl/260004 mentions this issue: internal/lsp: handle major version bumps in workspace module mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants