build-image
build-image copied to clipboard
Go dependency caching is ineffective
It doesn't look like the Go dependency cache is actually being persisted. Note how at the start of the build $(GOPATH)/pkg is always empty, gets filled with dependencies, and then at the next build is empty again.
This is probably costing everyone quite some CPU time and bandwidth.
[build]
command = "make"
functions = ".netlify/functions"
[build.environment]
GO_VERSION = "1.14.2" # https://github.com/netlify/build-image/issues/205
.netlify/functions/go-get: go.mod go.sum netlify-functions/go-get/*.go
find "$(GOPATH)/pkg" -type f | wc -l
GOBIN=$(PWD)/.netlify/functions go install ./netlify-functions/go-get
find "$(GOPATH)/pkg" -type f | wc -l
7:32:36 PM: Executing user command: make
7:32:36 PM: find "/opt/buildhome/.gimme_cache/gopath/pkg" -type f | wc -l
7:32:36 PM: find: ‘/opt/buildhome/.gimme_cache/gopath/pkg’
7:32:36 PM: : No such file or directory
7:32:36 PM: 0
7:32:36 PM: GOBIN=/opt/build/repo/filippo.io/.netlify/functions go install ./netlify-functions/go-get
7:32:37 PM: go: downloading github.com/aws/aws-lambda-go v1.16.0
7:32:38 PM: find "/opt/buildhome/.gimme_cache/gopath/pkg" -type f | wc -l
7:32:38 PM: 233