-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: document .lock files in the module cache #51121
Comments
Thanks for the report. This does't need to be a proposal, so taking it out of the proposal process. |
CC @bcmills |
To solve this problem it is possible to set to GOCACHE environment variable to a path that is writable by the non root user that runs the go compiler. Maybe this should be documented more. |
Unfortunately this does not seem to have an effect on the lockfile. For example, if I add:
To the very top of my Dockerfile, while I do get caching data in that directory: /app $ ls /tmp/gocache
00 0f 1e 2d 3c 4b 5a 69 78 87 96 a4 b3 c2 d1 e0 ef fe
01 10 1f 2e 3d 4c 5b 6a 79 88 97 a5 b4 c3 d2 e1 f0 ff
02 11 20 2f 3e 4d 5c 6b 7a 89 98 a6 b5 c4 d3 e2 f1 trim.txt
03 12 21 30 3f 4e 5d 6c 7b 8a 99 a7 b6 c5 d4 e3 f2
04 13 22 31 40 4f 5e 6d 7c 8b 9a a8 b7 c6 d5 e4 f3
05 14 23 32 41 50 5f 6e 7d 8c 9b a9 b8 c7 d6 e5 f4
06 15 24 33 42 51 60 6f 7e 8d 9c aa b9 c8 d7 e6 f5
07 16 25 34 43 52 61 70 7f 8e 9d ab ba c9 d8 e7 f6
08 17 26 35 44 53 62 71 80 8f 9e ac bb ca d9 e8 f7
09 18 27 36 45 54 63 72 81 90 9f ad bc cb da e9 f8
0a 19 28 37 46 55 64 73 82 91 README ae bd cc db ea f9
0b 1a 29 38 47 56 65 74 83 92 a0 af be cd dc eb fa
0c 1b 2a 39 48 57 66 75 84 93 a1 b0 bf ce dd ec fb
0d 1c 2b 3a 49 58 67 76 85 94 a2 b1 c0 cf de ed fc
0e 1d 2c 3b 4a 59 68 77 86 95 a3 b2 c1 d0 df ee fd I still get the same error about the same lockfile in the same path. |
Ah sorry, you will also have to set GOMODCACHE. See #34527 |
.lock files in the go modules cache are a frequent source of issues for us. Take the following common use case for example: when running go in a Docker container that has had dependencies installed into it as part of building the Docker image, these dependencies are naturally owned by
root
with 755 permissions.However, when running
go build
in the container, naturally, the user is no longer root at this time, and one sees frequent issues in the form of:because the root-owned file is obviously not writable to the user.
I was very surprised to see there was no documentation of this type of file available anywhere. I would like to suggest that, for example this page would explain the purpose and functioning of these files, to provide insight into errors such as these, so they can be resolved. Alternatively, I would also welcome a suggested workflow change, to make these files no longer a problem, such that they can stay implementation details that can be disregarded by the user.
The text was updated successfully, but these errors were encountered: