We are experiencing build failures on travis-ci/worker, which appear to be as a result of a network error. There were no changes to .snapcraft.yml on our side (except of updating go/1.12 => go/1.13, but we had the same error before this change)
Cloning into 'travis-worker'...
[24/Feb/2020:10:59:00 +0000] "CONNECT github.com:443 HTTP/1.1" 200 5883777 "-" "git/2.17.1"
Running pull phase...
snapd is not logged in, snap install commands will use sudo
go (1.13/stable) 1.13.8 from Michael Hudson-Doyle (mwhudson) installed
snapd is not logged in, snap install commands will use sudo
go 1.13.8 from Michael Hudson-Doyle (mwhudson) refreshed
[24/Feb/2020:10:59:13 +0000] "CONNECT api.snapcraft.io:443 HTTP/1.0" 200 14067 "-" "-"
Pulling travis-worker
go: directory github.com/travis-ci/worker is outside main module
go: directory github.com/travis-ci/worker/backend is outside main module
go: directory github.com/travis-ci/worker/cmd/travis-worker is outside main module
go: directory github.com/travis-ci/worker/config is outside main module
go: directory github.com/travis-ci/worker/context is outside main module
go: directory github.com/travis-ci/worker/errors is outside main module
go: directory github.com/travis-ci/worker/image is outside main module
go: directory github.com/travis-ci/worker/metrics is outside main module
go: directory github.com/travis-ci/worker/ratelimit is outside main module
go: directory github.com/travis-ci/worker/remote is outside main module
go: directory github.com/travis-ci/worker/ssh is outside main module
go: directory github.com/travis-ci/worker/winrm is outside main module
[24/Feb/2020:10:59:15 +0000] "CONNECT proxy.golang.org:443 HTTP/1.1" 200 42307 "-" "Go-http-client/1.1"
go get -t -d ./github.com/travis-ci/worker/...
Failed to run 'go get -t -d ./github.com/travis-ci/worker/...' for 'travis-worker': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Build failed
Well I’m not quite sure how to translate the “is outside main module” error (warning? info?). Perhaps a go expert could weigh in on that one…
Regardless, I just fired off a build to see if it was a temporary network issue. It does appear to build fine now without the “outside main module” statements [1]. If you retry the build and it still fails, that would be interesting to know.
Well I think I finally sorted this one out. It looks like multiple issues at play.
golang seems to have a bug (?) in this scenario, or we’re using it wrong…
1.13.8 produces the above message
1.14 (from the snap) crashes on go get
setting GO111MODULE=off appears to fix the behavior for 1.13 and 1.14
proper go.mod support is in snapcraft 3.10, not 3.9 (the current stable version that build.snapcraft.io uses)
the YAML specifies the go version in build-snaps. However, the go plugin has a property go-channel which sets the go snap version. The default value is latest/stable, so 1.13.8 (the current latest/stable) ends up installed regardless of whats in the build-snaps.