Browse Source

Fix --version string and duplicate printing

Kailash Nadh 4 years ago
parent
commit
e9bf47b006
3 changed files with 4 additions and 5 deletions
  1. 2 3
      Makefile
  2. 2 1
      cmd/main.go
  3. 0 1
      cmd/updates.go

+ 2 - 3
Makefile

@@ -1,7 +1,6 @@
 LAST_COMMIT := $(shell git rev-parse --short HEAD)
 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
 BIN := listmonk
 STATIC := config.toml.sample \
 STATIC := config.toml.sample \

+ 2 - 1
cmd/main.go

@@ -71,7 +71,6 @@ var (
 )
 )
 
 
 func init() {
 func init() {
-	lo.Println(buildString)
 	initFlags()
 	initFlags()
 
 
 	// Display version.
 	// Display version.
@@ -80,6 +79,8 @@ func init() {
 		os.Exit(0)
 		os.Exit(0)
 	}
 	}
 
 
+	lo.Println(buildString)
+
 	// Generate new config.
 	// Generate new config.
 	if ko.Bool("new-config") {
 	if ko.Bool("new-config") {
 		if err := newConfigFile(); err != nil {
 		if err := newConfigFile(); err != nil {

+ 0 - 1
cmd/updates.go

@@ -32,7 +32,6 @@ var reSemver = regexp.MustCompile(`-(.*)`)
 func checkUpdates(curVersion string, interval time.Duration, app *App) {
 func checkUpdates(curVersion string, interval time.Duration, app *App) {
 	// Strip -* suffix.
 	// Strip -* suffix.
 	curVersion = reSemver.ReplaceAllString(curVersion, "")
 	curVersion = reSemver.ReplaceAllString(curVersion, "")
-
 	time.Sleep(time.Second * 1)
 	time.Sleep(time.Second * 1)
 	ticker := time.NewTicker(interval)
 	ticker := time.NewTicker(interval)
 	for ; true; <-ticker.C {
 	for ; true; <-ticker.C {