Open build services like Launchpad PPA usually forbid internet connections during building, therefore it's impossible to download dependencies during building, and we need to include all dependencies into the source package.
Two things need to be done for building Golang softwares on no-internet building services:
- Download all dependencies into
vendor/
viago mod vendor
command. This is usually done on the local machine with internet connections. - Ask Golang compiler to use
vendor/
viago build -mod vendor
command. Usually insidedebian/rules
file orMakefile
.
If you're also working on Launchpad PPA like me, it's also suggested that add Simon Eisenmann's Golang Backports to the building dependency settings. This repository includes new Golang softwares so that you won't be hit by something like "syntax error".