FS#57545 - [go] Do not bundle cache with go 1.10 to reduce size

Attached to Project: Arch Linux
Opened by Peter Wu (Lekensteyn) - Saturday, 17 February 2018, 11:35 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Sunday, 18 February 2018, 12:32 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No


Upgraded go (2:1.9.4-1 -> 2:1.10-1) and found an increase in installed size from 298.76 MiB -> 691.43 MiB
(and a corresponding download size increase from 62 MiB -> 129 MiB).
It turns out that a new /usr/lib/go/pkg/obj/go-build/ alone consumes 390 MiB.

This appears to be a new feature to make builds faster (https://tip.golang.org/doc/go1.10):
> The go build command now maintains a cache of recently built packages,
> separate from the installed packages in $GOROOT/pkg or $GOPATH/pkg.
> The effect of the cache should be to speed builds that do not
> explicitly install packages or when switching between different
> copies of source code [..]

For more details, see https://tip.golang.org/cmd/go/#hdr-Build_and_test_caching and the announcement at https://groups.google.com/forum/#!topic/golang-dev/qfa3mHN4ZPA

Suggestion (one of):
- Disable build cache during build (GOCACHE=off), the generated go-build/log.txt prevents reproducible builds too.
- Set a different temporary cache dir during build (GOCACHE=$pkgdir/go-cache) to benefit from cache, but avoid package overhead
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Sunday, 18 February 2018, 12:32 GMT
Reason for closing:  Fixed
Additional comments about closing:  go 2:1.10-2
Comment by Bartłomiej Piotrowski (Barthalion) - Sunday, 18 February 2018, 11:34 GMT
My fault, I should have checked why the size increased. Next build will have GOCACHE set to 'off'.