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

cmd/go: go build follows symlinked directories, but go list does not #9054

Closed
crawshaw opened this issue Nov 3, 2014 · 3 comments
Closed

Comments

@crawshaw
Copy link
Member

crawshaw commented Nov 3, 2014

$ cat ~/foo/foo.go
package main

func main() {}
$ ln -s ~/foo $GOPATH/foo
$ go build foo # works
$ go list ... | grep foo # shows nothing
$

Should the Go tool support symlinks? Right now go build does, but go list does not.
@adonovan
Copy link
Member

adonovan commented Nov 3, 2014

Comment 1:

(I think $GOPATH/src/foo was intended.)

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

It's not build vs list. It's wildcards vs not.
If you say go build

, it resolves dir to its real value before continuing.
If you say go list ... it lists all known canonical paths.

I don't believe your example. I think it would show $GOPATH/src/foo as foo.
To make your example work you'd need to give the true $GOPATH dir a different name.

Symlinks cause all manner of weird behavior. It's best not to use them at all.

No intention to fix this, since I don't see what there is to fix.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@crawshaw
Copy link
Member Author

Closing. The underlying bug is that x/tools/go/loader behaves differently than go build when given a package name. I thought I had distilled this down into an issue in the Go tool, but I suspect I was wrong. Leaving the original issue for @adonovan.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants