From cf1b1e8c3f42c9cb450e9890961321cde73d144e Mon Sep 17 00:00:00 2001 From: Yogesh Sharma Date: Fri, 13 May 2022 13:24:35 -0400 Subject: [PATCH] Add versioning Add version to helpmessage Version is set during make from makefile variable Set version to 1.1 --- main.go | 4 +++- makefile | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index db483af..fcbb54e 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,8 @@ import ( //"flag" ) +var Version = "development" + type config struct { remoteTimeout time.Duration listenAddr string @@ -186,7 +188,7 @@ func main() { } func parseFlags() *config { - a := kingpin.New(filepath.Base(os.Args[0]), "Remote storage adapter [ PostgreSQL ]") + a := kingpin.New(filepath.Base(os.Args[0]), fmt.Sprintf("Remote storage adapter [ PostgreSQL ], Version: %s", Version)) a.HelpFlag.Short('h') cfg := &config{ diff --git a/makefile b/makefile index 69d4a4b..f8f20f5 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -VERSION=1.0-RC1 +VERSION=1.1 ORGANIZATION=crunchydata SOURCES:=$(shell find . -name '*.go' | grep -v './vendor') @@ -12,7 +12,7 @@ all: $(TARGET) build: $(TARGET) $(TARGET): main.go $(SOURCES) - go build -o $(TARGET) + go build -ldflags="-X 'main.Version=${VERSION}'" -o $(TARGET) container: $(TARGET) Dockerfile @#podman rmi $(ORGANIZATION)/$(TARGET):latest $(ORGANIZATION)/$(TARGET):$(VERSION)