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: file is not part of a package when found under a folder with spaces #33001

Open
omrishtam opened this issue Jul 9, 2019 · 5 comments

Comments

Projects
None yet
4 participants
@omrishtam
Copy link

commented Jul 9, 2019

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

$ go version
go version go1.12.7 linux/amd64

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
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/omri/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/omri/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build130351290=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I updated to the latest gopls version using vscode-go to update the tool, and also tried doing it with go get golang.org/x/tools/gopls@latest. I don't have the previous version that I used, but if I recall correctly, I haven't updated it for around 2-3 months. This issue also occurred while using go version 1.12(.0).

What did you expect to see?

I expected no errors to be shown, as it did before updating the tool.

What did you see instead?

I saw this error on a few package files I have, that are not main: file:///home/omri/Documents/Visual%20Studio%20Code/Go/api-gateway/server/server.go is not part of a package.

## Temporary workaround
I fixed this issue by changing the folder Visual Studio Code that I put my projects under, to VSCode (removed the spaces), and then it didn't show the error anymore and worked correctly.

Edit: Removed temporary workaround section as it doesn't necessarily work.

@gopherbot gopherbot added this to the Unreleased milestone Jul 9, 2019

@gopherbot gopherbot added the gopls label Jul 9, 2019

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 9, 2019

Can you consistently reproduce this error? Does the folder with spaces always show errors or only occasionally?

@omrishtam

This comment has been minimized.

Copy link
Author

commented Jul 9, 2019

Yes, I also made sure this reproduces on Windows 10 (I encountered it first on Ubuntu 19.04), and it always shows this error on any file that is not of package main when the project is found within a folder with spaces.

@omrishtam

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

Update: I also encountered it today on the same project under folder VSCode (the presumable temporary workaround), and the error showed again, until I restarted Visual Studio Code, after which it didn't show again.
I don't really understand the behavior of this error so I'll edit the issue to remove the Temporary workaround section.

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2019

Thanks for sharing. We will investigate this issue.

@marco-m

This comment has been minimized.

Copy link

commented Jul 13, 2019

As an additional data point, I am seeing the same error. The difference is that I don't have any folder with spaces in it. I am seeing it when the file is part of a vscode workspace.

What I noticed is the following: the error is reported by gopls when I add a comment to to the first line of the file, and the file is part of a Go package split in multiple files. If I keep the comment and just restart vscode, the error goes away :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.