In the source:
var COMMIT string;
In the go build command:
go build
go build -ldflags "-X github.com/FileFormatInfo/badger/cmd.COMMIT=$(git rev-parse --short HEAD)"
source
Date: 2020-01-03
Tags: golang
Share: