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/cmd/gopls: shows canonical path when in symlinked path #32377

Closed
mdhender opened this issue May 31, 2019 · 3 comments
Closed

x/tools/cmd/gopls: shows canonical path when in symlinked path #32377

mdhender opened this issue May 31, 2019 · 3 comments

Comments

@mdhender
Copy link
Contributor

@mdhender mdhender commented May 31, 2019

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

$ go version
go version go1.12.5 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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Volumes/ssdb/mdhender/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Volumes/ssda/mdhender/Software/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.5/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.5/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Volumes/ssdb/mdhender/Software/ui5app/go.mod"
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/5s/fp5yn8mn2yb5cjz4wbh1jbph0000gq/T/go-build534139428=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Ran code from a symlinked directory.

$ pwd
/Volumes/ssdb/mdhender/Software/ui5app
$ ll -d /Volumes/ssda/mdhender/Software/ui5app
drwxr-xr-x  17 mdhender  staff  578 May 31 16:14 /Volumes/ssda/mdhender/Software/ui5app
$ ll -d /Volumes/ssdb/mdhender/Software/ui5app
drwxr-xr-x  17 mdhender  staff  578 May 31 16:14 /Volumes/ssdb/mdhender/Software/ui5app
$ ll -d /Volumes/ssdb/mdhender/Software
lrwxr-xr-x  1 mdhender  wheel  32 Apr 22  2015 /Volumes/ssdb/mdhender/Software -> /Volumes/ssda/mdhender/Software/

Initially, hovering over an identifier will display the popup with information on the symbol. After an indeterminate while, the hover will stop, formatting will stop, and the output for gopls will display something like

[Info  - 4:29:19 PM] no signature help for file:///Volumes/ssda/mdhender/Software/ui5app/adapters/ui5/adapter.go:100:6 : cannot find an enclosing function
[Error - 4:29:20 PM] Request textDocument/codeAction failed.
  Message: /Volumes/ssda/mdhender/Software/ui5app/adapters/ui5/adapter.go:101:18: missing ',' in parameter list
  Code: 0 

Note that the path in the error message is the canonical path for my project, not the path that I opened the editor in.

and

[Error - 4:31:46 PM] Request textDocument/hover failed.
  Message: no room in queue
  Code: -32000 

An earlier error was

[Error - 2:17:19 PM] unable to check package for
file:///Volumes/ssda/mdhender/Software/ui5app/main.go: go [list -e -json -compiled=true -test=true -export=false -deps=true -find=false -- /Volumes/ssda/mdhender/Software/ui5app]: exit status 1: build github.com/mdhender/ui5app: cannot find module for path github.com/mdhender/ui5app/adapter

I haven't seen that again since a restart.

What did you expect to see?

Hovering over a symbol should show the popup and saving should do the formatting and updating import statements. Paths in the error messages should reflect the current location.

What did you see instead?

I'd expect that popups and formatting not stop working randomly. I'm surprised that the output shows the canonical path instead of the path that I started in, but I can almost understand that.

FWIW, I don't think that the apparent out of memory error is related to the symlink path. Just throwing that in for good measure.

@gopherbot gopherbot added this to the Unreleased milestone May 31, 2019
@gopherbot gopherbot added the gopls label May 31, 2019
@freeformz
Copy link
Contributor

@freeformz freeformz commented Jun 1, 2019

The "formatting will stop" part may be be related to #32368, which I patched, can you update gopls and see if that part of the problem continues?

WRT canonical path, this doesn't surprise me, but I'll leave further commentary up to others.

@mdhender
Copy link
Contributor Author

@mdhender mdhender commented Jun 1, 2019

@freeformz that seems to be the case here, too. Adding a file and deleting it, then making a change in another file cause the hover popup to say "Loading..." and then the "no room in queue" starts. I'll try updating gopls. Thanks!

Confirmed - updating gopls fixes the error with popups and formatting after deleting a .go file.

$ gopls version
golang.org/x/tools/cmd/gopls
    golang.org/x/tools@v0.0.0-20190531223538-26e35f15edef h1:tvvUBWZ5+WFnfcokh8TavIRxYRxUtmB+gQgCytJckhs=
@mdhender
Copy link
Contributor Author

@mdhender mdhender commented Jun 2, 2019

I'm ok with closing this since it seems to be a feature of os.Getwd:

Getwd returns a rooted path name corresponding to the current directory. If the current directory can be reached via multiple paths (due to symbolic links), Getwd may return any one of them.

@mdhender mdhender closed this Jun 2, 2019
@golang golang locked and limited conversation to collaborators Jun 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.