Golang software packaging for offline environment

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/ via go mod vendor command. This is usually done on the local machine with internet connections.
  • Ask Golang compiler to use vendor/ via go build -mod vendor command. Usually inside debian/rules file or Makefile.

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".

Leave a Comment