When doing a snapcraft remote-build, Snapcraft will create a copy of the project in Launchpad before running the snap build.
The problem is that Snapcraft seems to ignore tags while creating the copy of the project, which means the go generate ./cmd in the snapcraft.yaml's override-build will never dynamically generate the right version.
Solution
This PR enforces the execution of go generate ./cmd as a pre-requisite for running the snap build. I.e., for both local and remote builds, go generate ./cmd must be run first, such that the VERSION and version_generated.go files are staged in the repo, prior to the snap build, such that the override-build script can simply rely on that information and thus ignore the missing Git refs in the LP's project.
Problem
When doing a
snapcraft remote-build
, Snapcraft will create a copy of the project in Launchpad before running the snap build. The problem is that Snapcraft seems to ignore tags while creating the copy of the project, which means thego generate ./cmd
in thesnapcraft.yaml
'soverride-build
will never dynamically generate the right version.Solution
This PR enforces the execution of
go generate ./cmd
as a pre-requisite for running the snap build. I.e., for both local and remote builds,go generate ./cmd
must be run first, such that theVERSION
andversion_generated.go
files are staged in the repo, prior to the snap build, such that theoverride-build
script can simply rely on that information and thus ignore the missing Git refs in the LP's project.