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
cmd/go: go vet ./...
does not correctly resolve symlinks for the top directory
#12556
Comments
go vet ./...
does not correctly resolve symlinks for the top directorygo vet ./...
does not correctly resolve symlinks for the top directory
Symlinks are problematic with these tools. I'm not sure it can be made to work in all cases, or that it's worth trying. We encourage avoiding symlinks in the Go tree. |
CL https://golang.org/cl/23521 mentions this issue. |
I would like to echo that this issue is problematic for our team. Totally fine with this being the default behavior, but the issue is exacerbated by the difficulty of working around it in Go. Initially, we tried working around this by launching a new Go process that would invoke wd, _ := os.Getwd() // path may be a symlink
wd, _ = filepath.EvalSymlinks(wd) // this path is always absolute
cmd := exec.Command("go", "vet")
cmd.Dir = wd // set working directory of command to explicitly be absolute path
cmd.Run() // doesn't work -- os.Getwd() in relPaths() still returns symlink path However, this still doesn't work -- the We're working around this for now by taking advantage of the fact that So, long story short, I second that it would be nice to fix this issue -- although I agree and understand that symlinks into the Go path tree should be avoided, it would be nice to have the option to at least have a plausible work-around to handle this for tools that want to offer a more user-friendly experience. |
Change https://golang.org/cl/74750 mentions this issue: |
What version of Go are you using (go version)?
go version go1.4.2 darwin/amd64
What operating system and processor architecture are you using?
OS X 10.10.5, amd64
What did you do?
What did you expect to see?
Many other go commands
go tool cover
,godoc
andgo
work fine with this sort of symlink setup.What did you see instead?
I am not entirely sure. The
go vet
command appears to identify the symlink but can't find the files in it?The text was updated successfully, but these errors were encountered: