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: can't work on project in $GOPATH/pkg/mod #35485

Closed
jiacai2050 opened this issue Nov 10, 2019 · 7 comments
Closed

x/tools/gopls: can't work on project in $GOPATH/pkg/mod #35485

jiacai2050 opened this issue Nov 10, 2019 · 7 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.
Milestone

Comments

@jiacai2050
Copy link

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

$ go version
go version go1.13 darwin/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

GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/chenxiang/Library/Caches/go-build"
GOENV="/Users/chenxiang/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/chenxiang/code/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Users/chenxiang/.goenv/versions/1.13.0"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/chenxiang/.goenv/versions/1.13.0/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/fq/zphbvlvx6bxbq03lts1v2dnr0000gp/T/go-build949244485=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Use emacs + gopls to navigate project in $GOPATH/pkg/mod

What did you expect to see?

No error

What did you see instead?

LSP :: Connected to [gopls:94397 status:starting].
LSP :: go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe]: exit status 1: error writing go.mod: open $GOPATH/pkg/mod/github.com/cep21/circuit/v3@v3.1.0/go.mod298498081.tmp: permission denied
@gopherbot gopherbot added this to the Unreleased milestone Nov 10, 2019
@gopherbot
Copy link
Contributor

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@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 Nov 10, 2019
@ianthehat
Copy link

If you tried to directly open that folder, I would expect it to fail. gopls is designed to start from a valid project root (a writable source folder either in your GOPATH or with a go.mod and go.sum).

Nothing in $GOPATH/pkg/mod is a valid project, or should be opened directly as one, it is just a download cache for modules. The folders may not have correct go.mod files, and even if they do they are not writeable ones.

If you just want to explore the code, create a trivial project that depends on that module and open that instead.

@jiacai2050
Copy link
Author

No, I don't use gopls in $GOPATH/pkg/mod directly, but rather jump there by lsp-find-definition from my own app.

@muirdm
Copy link

muirdm commented Nov 11, 2019

I don't have any issues poking around in the mod cache in Emacs. Are you using a using a current version of lsp-mode? Can you provide steps to reproduce the issue?

@bcmills
Copy link
Contributor

bcmills commented Nov 11, 2019

Note that the combination of CL 204521 and CL 204878 (both upcoming in Go 1.14) will make go list, go test, etc. within the module cache much more likely to succeed.

That may also make the behavior of gopls more sensible for (read-only) workspaces within the module cache.

@bcmills
Copy link
Contributor

bcmills commented Nov 11, 2019

(And #34506 makes it so that gopls could potentially even resolve missing dependencies.)

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 4, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 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

6 participants