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/guru: referrers doesn't return references if used on the definition of the method #23318
Comments
Some more information when using Using
Here I expect to see the two usages of the function in the other files. Using
Using
|
Any ideas on what the cause of this could be? Or is there something I could try that would fix the issue? |
I'm seeing the same behavior on Windows as well. Haven't tried on a different platform yet. |
I found why Guru was behaving like this for my case. It appears that Guru doesn't work when there are symlinks in your I converted the symlink to a hardlink, and Guru started working for me. |
For me that's not the issue. I'm using VSCode with the Go extension. When I try to find usages of a method or field at the location where it's defined, it doesn't find usages in the same workspace (i.e. project) outside of the current package. |
Sorry, I wasn’t clear. I am not directly using guru myself. Like you, i was using Guru via VSCode’s Go extension. |
The problem still exists with go1.9.4. This issue is pretty severe, not being able to trust Find All References makes guru unusable. |
+1 |
Please don’t add “Me too” comments to issues: https://github.com/golang/go/wiki/NoMeToo @alandonovan for the original report. |
I've created a little proxy app that takes the guru call from VS Code and passes the arguments and stdin to the Linux version of guru installed in Windows WSL: https://github.com/tuhlmann/guru-wsl-bridge It works on my system, but hasn't been thoroughly yet, I'm only using it through Visual Studio Code. Maybe someone finds it helpful. |
This is still an issue with go 1.11. It works on mac/linux, but not on Windows. (No symlinks.) |
an issue here with go1.11 windows/amd64 |
This should be fixed by golang/tools#56 (CL 151057). |
Cool! I patched my local version of guru with the provided fix and it works for me. I'm using VSCode that uses the Windows version of the tools and WSL to compile and run the application. |
Thanks @doxxx for the fix, and @tuhlmann for the inspiration on how to get this patched and working locally for now! FYI - For others who want to test the patch on Windows VSCode, I followed these steps First confirm that find all references command is actually broken in your local Windows VSCode using Guru
Now make the local patch and confirm that find all references now works
@jltjohanlindqvist Can you please confirm that these steps work for you? One important note - When you select GetConfig function in VS Code, don't double click on the function name then click find all references (For some reason double click causes VS code to never return results). Instead hover over the method, then simply right click find all references. Then VS code will actually return references. |
I am on Mac OS 10.14.2 (latest) and the patch for Windows is NOT working for me. I am seeing the exact same issue @eparziale is illustrating in his first screenshot. Vscode is Version 1.30.2 (1.30.2), Go Extension is 0.8.0. go1.11.2 darwin/amd64. My project is outside GOPATH and uses GO111MODULES. This problem is pretty annoying, so any help is greatly appreciated! |
@martinrode It's possible that guru doesn't currently support Go Modules, which is much larger problem. The patch for Windows is purely to fix incorrect slashes in module paths. |
Import paths in Go use forward slashes, not the operating system's path separator. Fixes golang/go#24699. Fixes golang/go#23318.
Change https://golang.org/cl/151057 mentions this issue: |
What version of Go are you using (
go version
)?go version go1.9.2 windows/amd64
Does this issue reproduce with the latest release?
The latest stable, yes. I haven't tried the beta.
What operating system and processor architecture are you using (
go env
)?PS C:\code\go\bin> go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\code\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
What did you do?
Example project: config.zip
config.go
inpkg/config
GetConfig
. Get zero results.What did you expect to see?
All the references to the function
GetConfig
, in this case 2.What did you see instead?
Zero references are returned, when it should actually return 2.
The strange thing is that a colleague doesn't have this issue, and the only difference is that he's running VS Code on Mac, and I'm running it on Windows. There are other colleagues that have the same issue and they're running Windows as well.
Reference to issue that has already been opened but could not be solved on the vscode-go repo: microsoft/vscode-go#1415
The text was updated successfully, but these errors were encountered: