run:
go build
then run binary file, expected print:
def
run:
go build -tags abc
then run binary file, expected print:
abc
You can change abc
to aabbcc
or others in both main_abc.go
, main_def.go
and go build -tags aabbcc
.
In some case, you may want you Golang program supporting both MySQL and SQLite in seperate binaries.
With build tags option, you can build both MySQL and SQLite version binary with different build command without modify you Golang source code.