go-clean
remove Go build artifacts and cached data
TLDR
Clean build cache
$ go clean
Clean test cache$ go clean -testcache
Clean module cache$ go clean -modcache
Clean all caches$ go clean -cache -testcache -modcache
Clean specific package$ go clean [package]
SYNOPSIS
go clean [options] [packages]
DESCRIPTION
go clean removes object files and cached data. It cleans build artifacts, test results, and downloaded modules to free disk space or force rebuilding.
The command can target specific caches or packages. Cleaning the module cache removes all downloaded dependencies, requiring re-download on next build.
PARAMETERS
PACKAGES
Packages to clean.-cache
Clean build cache.-testcache
Clean test cache.-modcache
Clean module cache.-i
Remove installed archive.-n
Dry run.--help
Display help information.
CAVEATS
Module cache clean affects all projects. Test cache clean forces test reruns. May need re-download dependencies.
HISTORY
go clean is part of the Go toolchain, providing cache and artifact management.
