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: current directory shouldn't matter #32663

Closed
pierrre opened this issue Jun 18, 2019 · 4 comments
Closed

x/tools/gopls: current directory shouldn't matter #32663

pierrre opened this issue Jun 18, 2019 · 4 comments
Labels
Milestone

Comments

@pierrre
Copy link

@pierrre pierrre commented Jun 18, 2019

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

go1.12.6 linux/amd64

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

go env Output
$ go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pierre/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pierre/go"
GOPROXY=""
GORACE=""
GOROOT="/home/pierre/.gimme/versions/go1.12.6.src"
GOTMPDIR=""
GOTOOLDIR="/home/pierre/.gimme/versions/go1.12.6.src/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-build146965632=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I've opened an issue here microsoft/vscode-go#2579
It seems that the current directory while running gopls is very important.
If the current directory is not inside my project, gopls doesn't work.
I guess it's used in order to find the go.mod file.

What did you expect to see?

gopls should run even if the current directory is not inside my project.

What did you see instead?

See the other Github issue.

@gopherbot gopherbot added this to the Unreleased milestone Jun 18, 2019
@gopherbot gopherbot added the gopls label Jun 18, 2019
@mattn

This comment has been minimized.

Copy link
Member

@mattn mattn commented Jun 18, 2019

Do you set $GO111MODULE ?

@pierrre

This comment has been minimized.

Copy link
Author

@pierrre pierrre commented Jun 18, 2019

@mattn no, I don't set $GO111MODULE.
I'm just using vscode-go.

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Jun 18, 2019

@pierrre: In your linked issue, you mentioned working in a directory outside your $GOPATH, which leads me to believe that you are using modules. In this case, you will need to open each module root as a separate workspace root. VSCode-Go sends a "rootURI" to gopls on initialization, which gopls treats as the module root. We hope to improve the user experience for editing multiple modules simultaneously in the future (see #32394).

@pierrre

This comment has been minimized.

Copy link
Author

@pierrre pierrre commented Jun 19, 2019

OK, thank you.
I'm closing this issue, because it's a duplicate of #32394

@pierrre pierrre closed this Jun 19, 2019
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
4 participants
You can’t perform that action at this time.