Go: x/tools/cmd/guru: referrers does not show references from entire GOPATH in windows

Created on 5 Apr 2018  路  4Comments  路  Source: golang/go

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

go 1.9.2

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

windows 7 amd64

What did you do?

I tried to find all the references of a go function from entire GOPATH.
In linux it works as expected.But in windows it shows only the references from the same package.

command:-
guru -json referrers src\samplepac\sample.go:#3242,#3249

FrozenDueToAge NeedsFix OS-Windows

All 4 comments

This line appears to be the culprit:

https://github.com/golang/tools/blob/a5b4c53f6e8bdcafa95a94671bf2d1203365858b/cmd/guru/what.go#L205

The slashes of the import path are not normalized, which causes comparisons fail later on (here, specifically). Using filepath.ToSlash on importPath appears to fix the problem. For example,

importPath = filepath.ToSlash(importPath)

Change https://golang.org/cl/151057 mentions this issue: cmd/guru: fix guessImportPath for Windows

I'm affected too. I confirm the change at https://golang.org/cl/151057 fixes the problem.

I think this is a dupe of #23318.

Was this page helpful?
0 / 5 - 0 ratings