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: errors with non-existent directory in a multi-folder workspace #41255

Open
segevfiner opened this issue Sep 7, 2020 · 2 comments
Open

Comments

@segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Sep 7, 2020

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

$ go version
go version go1.15.1 darwin/amd64

$ gopls version
golang.org/x/tools/gopls 0.4.4
    golang.org/x/tools/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users//Library/Caches/go-build"
GOENV="/Users//Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users//go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users//go"
GOPRIVATE="github.com/OceanCodes"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b_/c6yh0ksn63d1yy192x2p9f4c0000gn/T/go-build483292181=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Create a multi-folder workspace with one of the folders missing and others having go modules projects.
  2. Open it in VS Code.
  3. gopls will error:
Error loading workspace folders (expected 10, got 9)
failed to load view for file:///path/to/missing/folder: invalid workspace configuration: no such file or directory

What did you expect to see?

It should just ignore that folder. It's common to end up in a situation like that when working on multiple branches.

A workaround for now is to create that directory, leaving it empty. But that has to be done again from time to time when moving between branches.

What did you see instead?

It errors.

@gopherbot gopherbot added this to the Unreleased milestone Sep 7, 2020
@stamblerre stamblerre changed the title x/tools/gopls: A non existing folder in a multi-folder workspace confuses gopls x/tools/gopls: non-existent directory in a multi-folder workspace causes errors Sep 7, 2020
@stamblerre stamblerre removed this from the Unreleased milestone Sep 7, 2020
@stamblerre stamblerre changed the title x/tools/gopls: non-existent directory in a multi-folder workspace causes errors x/tools/gopls: errors with non-existent directory in a multi-folder workspace Sep 7, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Sep 7, 2020

In this case, does gopls fail to work or does it just show an error message? I haven't tested this out yet, but based on the code it should just show an error and then continue to work for the other folders in the workspace.

@segevfiner
Copy link
Contributor Author

@segevfiner segevfiner commented Sep 7, 2020

It does seem to work. But I remember I had an issue with it also not working, but that might have been caused by something else as I'm not currently able to reproduce it not working. If I'll manage to reproduce a case where this specifically causes something to not work, I'll update here.

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
You can’t perform that action at this time.