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

Closed
segevfiner opened this issue Sep 7, 2020 · 5 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@segevfiner
Copy link
Contributor

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 Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Sep 7, 2020
@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

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.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 7, 2020
@segevfiner
Copy link
Contributor Author

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.

@segevfiner
Copy link
Contributor Author

segevfiner commented Oct 14, 2020

I just had a workspace where I had a missing folder and gopls will not respond to changes to any go file and refresh build errors when that happened. Though that can always be VS Code itself or gopls bugging out for an unrelated reason.

Using gopls 0.5.1 and VS Code 1.50.0.

@stamblerre
Copy link
Contributor

Thank you for the update, but unfortunately it's difficult to investigate without a log or a concrete repro case. Instructions on how to capture a log can be found here: https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capturing-logs.

@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
@stamblerre
Copy link
Contributor

Closing, as there has not been any activity on this issue for over a month.

@stamblerre stamblerre removed this from the gopls/unplanned milestone Nov 22, 2020
@golang golang locked and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. 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