From e9bf47b00673474b98f1914063f07533ad47b077 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 18 Oct 2020 22:59:22 +0530 Subject: [PATCH] Fix --version string and duplicate printing --- Makefile | 5 ++--- cmd/main.go | 3 ++- cmd/updates.go | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 29e97bc..9ef68aa 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ LAST_COMMIT := $(shell git rev-parse --short HEAD) -LAST_COMMIT_DATE := $(shell git show -s --format=%ci ${LAST_COMMIT}) -VERSION := $(shell git describe --tags) -BUILDSTR := ${VERSION} (${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z")) +VERSION := $(shell git describe --tags --abbrev=0) +BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z")) BIN := listmonk STATIC := config.toml.sample \ diff --git a/cmd/main.go b/cmd/main.go index 3bdf9b1..02821f9 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -71,7 +71,6 @@ var ( ) func init() { - lo.Println(buildString) initFlags() // Display version. @@ -80,6 +79,8 @@ func init() { os.Exit(0) } + lo.Println(buildString) + // Generate new config. if ko.Bool("new-config") { if err := newConfigFile(); err != nil { diff --git a/cmd/updates.go b/cmd/updates.go index 085618a..09141b4 100644 --- a/cmd/updates.go +++ b/cmd/updates.go @@ -32,7 +32,6 @@ var reSemver = regexp.MustCompile(`-(.*)`) func checkUpdates(curVersion string, interval time.Duration, app *App) { // Strip -* suffix. curVersion = reSemver.ReplaceAllString(curVersion, "") - time.Sleep(time.Second * 1) ticker := time.NewTicker(interval) for ; true; <-ticker.C {