3 ms·
BUILD=`git rev-parse HEAD` LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" # ... $(BINARY): go build ${LDFLAGS} -o {$BINARY} ./
by dozzie 10y ago
BUILD=`git rev-parse HEAD`
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
# ...
$(BINARY):
go build ${LDFLAGS} -o {$BINARY} ./..
Please don't do that. This ties the build process to be run from inside the
git repository, which starts to be a problem if you have any sane method of
code deployment (building source packages). Think of something different.
And yes, there is a typo in the build rules.
- jquast 10y agoI rather prefer this scenario, labeling a package release with vcs revision id or even branch name, for example.