Building with tags
By now, we have built our applications using Makefile
, which contains the following command specific to building a Darwin application:
build-darwin: go build -tags darwin -o bin/audiofile main.go chmod +x bin/audiofile
For the Darwin build, we can additionally build a version for a free and pro version and also a profile version to enable pprof
.
Building a free version
To build a free
version for the Darwin operating system, we need to modify the preceding make
command and create a new one:
build-darwin-free: go build -tags "darwin free" -o bin/audiofile main.go chmod +x bin/audiofile
In the build-darwin-free
command, we pass in the two build tags: darwin
and free
. This will include files such as bug_darwin.go
and play_darwin.go
, which contain the following line at the top of the Go file:
//go:build darwin
Similarly, the files will be...