From 0684b15a44be8ac03a20fb44a1886e137ae5ea9c Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Tue, 7 Jul 2020 10:49:58 -0700 Subject: [PATCH] Update logic for setting version I noticed that versions were not being properly dervied from the git tags. This fixes that in a simpler way by allowing git to describe the current commit with tags, commits, shas, and a dirty maker. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 76c8f04..6b80e8f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ DOCKER_TAG ?= minitor-go-${USER} -GIT_TAG_NAME := $(shell git tag -l --contains HEAD) -GIT_SHA := $(shell git rev-parse HEAD) -export VERSION := $(if $(GIT_TAG_NAME),$(GIT_TAG_NAME),$(GIT_SHA)) +export VERSION := $(shell git describe --tags --dirty) GOFILES = *.go # Multi-arch targets are generated from this TARGET_ALIAS = minitor-linux-amd64 minitor-linux-arm minitor-linux-arm64 minitor-darwin-amd64 TARGETS = $(addprefix dist/,$(TARGET_ALIAS)) +# # Default make target will run tests .DEFAULT_GOAL = test