Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.16k stars 539 forks source link

Need override for tmp location due to cross-device link error #1065

Closed ideasculptor closed 4 years ago

ideasculptor commented 4 years ago

glide install is slow when building in a docker container because it uses a directory in /tmp: /tmp/glide-vendor369540807/vendor to create the vendor directory in the source tree. Since my source tree is mounted from the host, but /tmp is local to the container, the dir rename fails and it has to copy the entire vendor tree, instead. This is unnecessarily slow. It would be convenient to be able to override the location it uses for the temporary vendor directory so that I can ensure it is also on the mounted device, ensuring a rename would work. I couldn't find an obvious source for an override in the glide README or a google search.

ideasculptor commented 4 years ago

Relevant Debug statement to aid others searching for a similar solution:

[DEBUG] Cross link err, trying manual copy: rename /tmp/glide-vendor369540807/vendor /vendor: invalid cross-device link

ideasculptor commented 4 years ago

Traced through the code, which eventually uses os.TempDir which uses $TMPDIR environment variable. So setting $TMPDIR to a path on the same device will correct this problem.

Would be a useful thing to call out in documentation.