go clean

The go subcommand that removes files produced by builds, and with flags can also empty the build and test caches.

In more detail

Day to day you rarely need it, because the build cache keeps itself correct. go clean -cache and go clean -testcache are useful when disk space runs low or when you want to rule the cache out while chasing a strange result.

Example

go clean -testcache

Related terms

Taught in

References