I’m trying to build a rather complex Go program that requires multiple steps before it’s built.
One of the steps is to install a Go command and run it. In bash, it’s literally a two-liner.
go get -u -v github.com/GeertJohan/go.rice/rice rice embed-go
How can I achieve that during the build process of a Snap?
You can use the override-build section in your part. This lets you add additional commands to the default build process for your part.
override-build
The simplest no change override-build section is:
parts: partname: ... override-build: | snapcraftctl build
This is replacing the build step of the part with a request for Snapcraft to run the default build step. If you place some additional commands before snapcraftctl build, then they will be run before the default build commands.
snapcraftctl build
Thanks, that worked!