You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
guru uses textual (not inode) equality to compare filenames in some places. As a result, file name aliases arising from symbolic links confuse the tool. For example, many users set GOPATH=$HOME and add a symbolic link $HOME/src -> $HOME/somedir/src. If the file name used in the guru command (which is the file name of the editor buffer) does not match the file name used in the GOPATH variable, the tool reports the wrong result.
In the session below, $HOME/gotN is the actual workspace directory and $HOME/src is an alias of $HOME/gotN/src. In the first two commands, the GOPATH and filenames match and the commands succeed; in the second two commands they do not match and so they fail. NOTE: the bug was partially masked by https://go-review.googlesource.com/c/30451, so the session below makes sense only if we roll back to before that change. (The fix can be evaluated with a unit test of guru's pkgContainsFile function.)
$ GOPATH=$/HOME/gotN guru implements ~/gotN/src/foo/main.go:#19
/home/adonovan/gotN/src/foo/main.go:3:6: struct type T
/home/adonovan/gotN/src/foo/main.go:7:6: implements I
$ GOPATH=$HOME guru implements ~/src/foo/main.go:#19
/home/adonovan/src/foo/main.go:3:6: struct type T
/home/adonovan/src/foo/main.go:7:6: implements I
$ GOPATH=$HOME guru implements ~/gotN/src/foo/main.go:#19
guru: directory /home/adonovan/gotN/src/foo is not beneath any of these GOROOT/GOPATH directories: /home/adonovan/go/src, /home/adonovan/src
$ GOPATH=$/HOME/gotN guru implements ~/src/foo/main.go:#19
guru: directory /home/adonovan/src/foo is not beneath any of these GOROOT/GOPATH directories: /home/adonovan/go/src, /home/adonovan/gotN/src
The text was updated successfully, but these errors were encountered:
quentinmit
changed the title
guru: handle source file aliasing gracefully
x/tools/cmd/guru: handle source file aliasing gracefully
Oct 20, 2016
guru uses textual (not inode) equality to compare filenames in some places. As a result, file name aliases arising from symbolic links confuse the tool. For example, many users set GOPATH=$HOME and add a symbolic link
$HOME/src -> $HOME/somedir/src
. If the file name used in the guru command (which is the file name of the editor buffer) does not match the file name used in the GOPATH variable, the tool reports the wrong result.In the session below, $HOME/gotN is the actual workspace directory and $HOME/src is an alias of $HOME/gotN/src. In the first two commands, the GOPATH and filenames match and the commands succeed; in the second two commands they do not match and so they fail. NOTE: the bug was partially masked by https://go-review.googlesource.com/c/30451, so the session below makes sense only if we roll back to before that change. (The fix can be evaluated with a unit test of guru's
pkgContainsFile
function.)The text was updated successfully, but these errors were encountered: