Skip to content

Instantly share code, notes, and snippets.

@kevinadi
Created June 27, 2019 01:42
Makefile for Go to automatically stamp Git info and build date
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