Problem or motivation
Sandboxed Go test runs use an isolated persistent cache under ~/.yottacode/sandbox-go-cache/ so containers can reuse GOCACHE and GOMODCACHE without bind-mounting the host's normal Go cache paths.
That isolation is the right default, but the cache is currently hidden and unbounded. On one local machine it reached:
du -csh ~/.yottacode/sandbox-go-cache/
2.2G /home/ppetkov/.yottacode/sandbox-go-cache/
2.2G total
A quick breakdown showed most of that was compiled build/test cache, not downloaded modules:
1.7G ~/.yottacode/sandbox-go-cache/cache
479M ~/.yottacode/sandbox-go-cache/modcache
Proposed solution
Add a yottacode doctor check that reports sandbox Go cache size when ~/.yottacode/sandbox-go-cache/ exists, with a warning when it exceeds a reasonable threshold.
The check should distinguish at least:
- total sandbox Go cache size
- build/test cache size:
~/.yottacode/sandbox-go-cache/cache
- module cache size:
~/.yottacode/sandbox-go-cache/modcache
Suggested behavior:
- no warning when the directory does not exist
- informational output when it exists and is modest
- warning when total size exceeds a threshold such as 1–2 GB
- include cleanup guidance that preserves the distinction between build cache and module cache
Example guidance:
# Reclaim compiled build/test artifacts; modules remain cached.
GOCACHE="$HOME/.yottacode/sandbox-go-cache/cache" \
GOMODCACHE="$HOME/.yottacode/sandbox-go-cache/modcache" \
go clean -cache -testcache
# Stronger cleanup; next sandboxed Go run may redownload dependencies.
GOCACHE="$HOME/.yottacode/sandbox-go-cache/cache" \
GOMODCACHE="$HOME/.yottacode/sandbox-go-cache/modcache" \
go clean -cache -testcache -modcache
Alternatives considered
- Reuse host Go cache paths directly (
~/.cache/go-build, ~/go/pkg/mod, or custom host GOCACHE/GOMODCACHE). Rejected as the default because it widens the sandbox boundary, exposes/mutates broader developer state, and complicates Podman/SELinux/cache configuration.
- Automatically clean on every sandboxed test run. Rejected because it defeats cache reuse and would make the first Go command in every sandbox session slow again.
- Automatically clean
modcache. Rejected as a default because it causes future dependency downloads.
Prior art
Go exposes explicit cleanup through go clean -cache, go clean -testcache, and go clean -modcache. yottacode should surface the same distinction for its own isolated sandbox cache.
Would you be willing to contribute this?
Yes, I'd like to open a PR.
Problem or motivation
Sandboxed Go test runs use an isolated persistent cache under
~/.yottacode/sandbox-go-cache/so containers can reuseGOCACHEandGOMODCACHEwithout bind-mounting the host's normal Go cache paths.That isolation is the right default, but the cache is currently hidden and unbounded. On one local machine it reached:
du -csh ~/.yottacode/sandbox-go-cache/ 2.2G /home/ppetkov/.yottacode/sandbox-go-cache/ 2.2G totalA quick breakdown showed most of that was compiled build/test cache, not downloaded modules:
Proposed solution
Add a
yottacode doctorcheck that reports sandbox Go cache size when~/.yottacode/sandbox-go-cache/exists, with a warning when it exceeds a reasonable threshold.The check should distinguish at least:
~/.yottacode/sandbox-go-cache/cache~/.yottacode/sandbox-go-cache/modcacheSuggested behavior:
Example guidance:
Alternatives considered
~/.cache/go-build,~/go/pkg/mod, or custom hostGOCACHE/GOMODCACHE). Rejected as the default because it widens the sandbox boundary, exposes/mutates broader developer state, and complicates Podman/SELinux/cache configuration.modcache. Rejected as a default because it causes future dependency downloads.Prior art
Go exposes explicit cleanup through
go clean -cache,go clean -testcache, andgo clean -modcache. yottacode should surface the same distinction for its own isolated sandbox cache.Would you be willing to contribute this?
Yes, I'd like to open a PR.