diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..49d5957 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1 diff --git a/makefile b/makefile index 628f638..ab16706 100644 --- a/makefile +++ b/makefile @@ -1,11 +1,17 @@ BINARY := gfu PKGS := $(shell go list ./... |grep -v /vendor) -VERSION := $(shell git describe --tags) -BUILD := $(shell date -Iminutes) -LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD}" +# version checks git tags. if any errors, they are discarded, and the version is +# read from the VERSION file +VERSION := $(shell git describe --tags 2> /dev/null) +ifeq ($(VERSION),) + VERSION := $(shell cat VERSION) +endif +BUILD := $(shell date -Iminutes) + #ldflags for versioning info: https://stackoverflow.com/questions/11354518/application-auto-build-versioning #-s flag info: https://blog.spiralscout.com/using-w-and-s-flags-in-golang-97ae59b50e26 +LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD}" build: go build ${LDFLAGS} -o ${BINARY} @@ -14,12 +20,10 @@ build: install: go install ${LDFLAGS} +.PHONY: uninstall +uninstall: + go clean -i + .PHONY: clean clean: go clean - -.PHONY: test -test: - go test $(PKGS) - -