From 91ee778665fd424cb2045163856df5b74dfb3f83 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Thu, 17 Aug 2017 14:04:17 +0900 Subject: [PATCH] Show commit ID on version --- Makefile | 7 ++++--- main.go | 2 +- version.go | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index be1ca79..f9f6e58 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ OUTPUT_DIR = ./builds -GIT_COMMIT = `git rev-parse HEAD` +GIT_COMMIT = `git rev-parse HEAD | cut -c1-10` +BUILD_OPTIONS = -ldflags "-X main.CommitID=$(GIT_COMMIT)" -gotty: server/asset.go main.go server/*.go webtty/*.go backend/*.go - godep go build +gotty: server/asset.go main.go server/*.go webtty/*.go backend/*.go Makefile + godep go build ${BUILD_OPTIONS} asset: server/asset.go diff --git a/main.go b/main.go index 8e0c03f..edef057 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( func main() { app := cli.NewApp() app.Name = "gotty" - app.Version = Version + app.Version = Version + "+" + CommitID app.Usage = "Share your terminal as a web application" app.HideHelp = true cli.AppHelpTemplate = helpTemplate diff --git a/version.go b/version.go index cbd65dd..bdab2f0 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,4 @@ package main var Version = "2.0.0-alpha" +var CommitID = "unknown_commit"