From 0ce8ebb65269f55da08885a15577e9ec64468320 Mon Sep 17 00:00:00 2001 From: Tomohiro Taira Date: Wed, 27 Nov 2019 23:53:28 +0900 Subject: [PATCH] Add revision and runtime info --- Makefile | 3 ++- main.go | 2 +- version.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8e44cef..0dbf002 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,14 @@ OWNER = "tomohiro" REPOSITORY = $(shell basename $(PWD)) VERSION = $(shell grep "const Version " $(PWD)/version.go | sed -E 's/.*"(.+)"$$/\1/') +REVISION = $(shell git rev-parse --short HEAD) # Build information DIST_DIR = $(PWD)/dist ASSETS_DIR = $(DIST_DIR)/$(VERSION) XC_OS = "linux darwin windows" XC_ARCH = "386 amd64" -BUILD_LDFLAGS = "-w -s" +BUILD_LDFLAGS = "-w -s -X main.revision=$(REVISION)" # Tasks help: diff --git a/main.go b/main.go index 9df0058..dad76ca 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ func realMain() int { Usage: "Gyazo command-line uploader", UsageText: "gyazo-cli [global options] [PATH]", Action: upload, - Version: fmt.Sprintf("%s-%s (build/%s)", Version, revision, runtime.Version()), + Version: fmt.Sprintf("%s (rev %s) [%s %s %s]", Version, revision, runtime.GOOS, runtime.GOARCH, runtime.Version()), Authors: []*cli.Author{ &cli.Author{ Name: "Tomohiro Taira", diff --git a/version.go b/version.go index 79f7150..53e1f06 100644 --- a/version.go +++ b/version.go @@ -3,4 +3,4 @@ package main // Version number that is being run at the moment. const Version string = "1.0.0" -const revision string = "devel" +var revision string = "devel"