-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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: build fails with sym links ("no Go files") #52406
Comments
In general the go tool intentionally does not support symlinks, but I don't know whether we've written that down anywhere. CC @bcmills |
It seems to me that you generally have to do something special to "fail" to read a link that ultimately points to the desired file (for instance, call lstat(2) instead of the typical stat(2) when determing file status information). If you just "read" the filename (using the name of the link), it (the system that allows symlinks to exist) would normally follow the link and things would "just work". I certainly don't know what go is doing under the covers, so I imagine it's more complicated than that. But I wouldn't think go would need to do anything special to do the typical "right" thing for symlinks, which is to just let the system follow the sym link to access the contents of the file in question. That said, this is an extremely difficult thing to debug and something of a cryptic failure. Go does not emit any information indicating why 'go mod vendor' behaves differently. If the decision is to "not support symlinks", at least go could provide more information so a user can see what is happening. Maybe there is a better way to trace what's going on, and I am just not aware of it yet. My first instinct was to add extra -v's, but that didn't help (for that matter a single -v didn't help). |
We don't go out of our way to support symlinks, and don't walk symlink directories when matching patterns like (Compare to the approach taken in https://cs.opensource.google/go/go/+/master:misc/cgo/test/overlaydir_test.go;drc=476395cb3e97cf7d9c50d8fe57c2c7926f1cff48.) @jhgit, that repro script has a lot going on. Can you reduce the behavior to a |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Unknown
What operating system and processor architecture are you using (
go env
)?env GOPATH=/tmp/go go env
OutputWhat did you do?
I am trying to build some go projects (e.g., https://github.com/FiloSottile/age, https://github.com/muesli/duf).
If I start with an GOPATH pointing to an empty directory tree or one already populated with downloaded files, the build succeeds. If GOPATH is a directory with symbolic links to files in another directory, the build fails.
Here is a script to reproduce the problem (using 'age' as an example, but this happens with other go projects as well). This script uses a tool called 'lndir' to create a hierarchy of sym links. It uses /tmp/src and /tmp/go and /tmp/go-links as working directories.
Observe errors (as shown below) from running
repro
script.I'm not sure where to start looking for the source of this error. Apologies if this issue is mis-categorized, but I'm also not sure if this is the best place to start.
What did you expect to see?
No errors.
What did you see instead?
Errors like the following (for a build of age):
Notice that vendor packages are missing (silently not downloaded) from the source tree after 'go mod vendor' when using the GOPATH hierarchy with symbolic links.
The text was updated successfully, but these errors were encountered: