Go caches two things, and Conda installs a whole scientific stack per environment
Module and build caches, environments and package archives. Where each lives on Windows and what the commands are.
Go and Conda both cache aggressively and both keep things on Windows in places the documentation writes as Unix paths, which is why half the advice does not match your machine.
Go, on Windows
go env GOPATH GOMODCACHE GOCACHE
Get-ChildItem "$env:USERPROFILE\go\pkg\mod","$env:LOCALAPPDATA\go-build" -EA SilentlyContinue |
ForEach-Object {
$s = (Get-ChildItem $_.FullName -Recurse -Force -File -EA SilentlyContinue | Measure-Object Length -Sum).Sum
'{0,8:N0} MB {1}' -f ($s/1MB), $_.FullName
}| Cache | Windows location | Command |
|---|---|---|
| Module cache | %USERPROFILE%\go\pkg\mod | go clean -modcache |
| Build cache | %LOCALAPPDATA%\go-build | go clean -cache |
The module cache is stored read only, which is why deleting it in Explorer produces a string of permission errors and a half removed cache that then fails checksum verification. go clean -modcache is the only sensible way to remove it.
Conda and Anaconda
conda info --envs
conda clean --all --dry-run
Get-ChildItem "$env:USERPROFILE\anaconda3\envs","$env:USERPROFILE\miniconda3\envs" -EA SilentlyContinue |
ForEach-Object {
$s = (Get-ChildItem $_.FullName -Recurse -Force -File -EA SilentlyContinue | Measure-Object Length -Sum).Sum
[PSCustomObject]@{ MB = [math]::Round($s/1MB); Env = $_.Name }
} | Sort-Object MB -Descendingconda clean --all removes downloaded archives, unused packages and the index cache. It does not touch environments, which is the important part: it is safe, and it also will not help if the environments are what is large.
Environments are the size
Each environment is a full directory tree, and one with a machine learning framework in it is several gigabytes. Export before removing and the folder becomes a file of a few kilobytes that recreates it exactly:
conda env export --name old-project > old-project.yml
conda env remove --name old-projectWhere this sits
On a Windows machine these live beside the pip cache and virtual environments, and a data science setup usually has both. Checking them together is one pass rather than three.
Common questions
Where is the Go module cache on Windows?
In %USERPROFILE%\go\pkg\mod, with the build cache separately in %LOCALAPPDATA%\go-build. Run go env GOMODCACHE GOCACHE to confirm for your installation.
Why can I not delete the Go module cache in Explorer?
Because it is stored read only on purpose. Deleting it by hand produces permission errors and a partly removed cache that fails checksum verification. Use go clean -modcache.
Does conda clean delete my environments?
No. conda clean --all removes cached archives, unused packages and the index cache. Environments are untouched, which also means it will not help if they are what is large.
How do I remove a conda environment safely?
Export it first with conda env export to a yml file, which recreates it exactly later, then remove it with conda env remove. That turns gigabytes into a few kilobytes.