How to run a bash command before building a Go program?

I’m trying to build a rather complex Go program that requires multiple steps before it’s built.

One of the steps is to run a Bash script that requires a specific command to be installed. In bash, it’s literally a two-liner.

sudo snap install ipfs
./scripts/ipfs.sh

How can I achieve that during the build process of a Snap?