-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Use of go.mod fails with golang 1.13+ unless run as root #49
Comments
can probably use the same trick that pre-commit uses if you'd like to send a patch and bump the tested go versions to the latest two (those are all that upstream supports) |
Projects that use go.mod will result in the build downloading the modules to an temporary path. Golang introduced read only directories to protect the generated module cache from accidental writes, resulting in failures to build when exiting the temporary directory context. Adapt the solution from pre-commit to make the directory and file writable on removal and include a rudimentary test that exercises download via a simple example module hosted by the golang org in github. Fixes asottile#49
I've updated the title, it appears to be an issue where use of go.mod or a module cache is involved where the directories were made not writable at least as far back as Aug 2018 golang/go#27161 (comment). It appears to be only use of go.mod that triggers this behaviour for this module, possibly because that is the only one that results in a module cache being populated under a temporary directory. This should mean that the current versions of go being tested are just fine, so I added a test that triggered the issue locally for me, and I believe should trigger it (if you remove the fix) on go from 1.11+ |
Projects that use go.mod will result in the build downloading the modules to an temporary path. Golang introduced read only directories to protect the generated module cache from accidental writes, resulting in failures to build when exiting the temporary directory context. Adapt the solution from pre-commit to make the directory and file writable on removal and include a rudimentary test that exercises download via a simple example module hosted by the golang org in github. Fixes asottile#49
Projects that use go.mod will result in the build downloading the modules to an temporary path. Golang introduced read only directories to protect the generated module cache from accidental writes, resulting in failures to build when exiting the temporary directory context. Adapt the solution from pre-commit to make the directory and file writable on removal and include a rudimentary test that exercises download via a simple example module hosted by the golang org in github. Fixes asottile#49
It appears newer versions of golang (not entirely sure when this was introduced) remove write permissions for the cache populated, which because it is under a temp directory context will trigger an error on attempt to remove.
Sanitizing the output because the project is an internal work based one
Notice no write access on the directory, even run manually:
gets the same error of
Permission denied
Though perhaps given that downloading the go dependencies pristine each time it might be more performant to allow the user to reuse their existing golang cache or even only download to the temp directory those files that are not already available under GOPATH as it can be a list of paths instead of a single path.
The text was updated successfully, but these errors were encountered: