[build][go] use GOCACHE for builds

GOCACHE allows for caching build artifacts and test results across
builds. As of Go 1.12, GOCACHE is required to be set if a user cache
directory cannot be determined (which is done using $HOME or
$XDG_CACHE_HOME). Neither of these environment variables are set during
our builds (and if they are, it's not necessarily likely that we would
like to use them), so we must set GOCACHE to build Go 1.12.

This change introduces a declared_arg to set the go cache directory,
which defaults to the root build directory joined with ".gocache". If
overridden, this argument must be a full path.

Change-Id: I0e509e498cb60772cbd94456afac6e1fe757e953
2 files changed