Created
June 27, 2019 01:42
-
-
Save kevinadi/f4a72a038f028aff58edbfde466073c1 to your computer and use it in GitHub Desktop.
Makefile for Go to automatically stamp Git info and build date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version=$(shell git describe --always --long --dirty) | |
date=$(shell date -j "+(%b %Y)") | |
all: | |
@go build -v -ldflags '-X "main.version=${version}" -X "main.date=${date}"' | |
install: | |
@go install -v -ldflags '-X "main.version=${version}" -X "main.date=${date}"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment