go
build_error
ai_generated
true
go: error obtaining build cache: open /root/.cache/go-build/log.txt: permission denied
ID: go/build-cache-invalid
80%Fix Rate
88%Confidence
0Evidence
2024-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.20 | active | — | — | — |
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
Root Cause
The build cache directory is owned by a different user or has incorrect permissions, preventing writing.
generic中文
构建缓存目录被其他用户拥有或权限不正确,阻止了写入操作。
Workarounds
-
95% success Change ownership of the build cache directory to the current user.
Run 'sudo chown -R $USER:$USER /root/.cache/go-build' (adjust path if needed).
-
90% success Set GOCACHE to a writable directory.
Run 'export GOCACHE=$HOME/.cache/go-build' and ensure the directory exists: 'mkdir -p $GOCACHE'.
Dead Ends
Common approaches that don't work:
-
Running 'go clean -cache' to clear cache.
80% fail
The command fails because it cannot access the cache to remove it.
-
Setting GOCACHE to a different path without creating it.
70% fail
Go won't automatically create the directory; it must exist with proper permissions.