From 4a423fdf8819c8a7041bce5f576bcfb428fa3707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20L=2E=20Hansen?= Date: Thu, 22 Apr 2021 08:20:08 -0700 Subject: [PATCH] Let git compute version number --- Makefile | 4 ++-- main.go | 2 +- version.go | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 50c63bc..78e5e6f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ OUTPUT_DIR = ./builds GIT_COMMIT = `git rev-parse HEAD | cut -c1-7` -VERSION = 1.1.0 -BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)" +VERSION = $(shell git describe --tags) +BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION)" gotty: main.go server/*.go webtty/*.go backend/*.go Makefile asset go build ${BUILD_OPTIONS} diff --git a/main.go b/main.go index 4bf1ee7..ae45b1e 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ import ( func main() { app := cli.NewApp() app.Name = "gotty" - app.Version = Version + "+" + CommitID + app.Version = Version app.Usage = "Share your terminal as a web application" app.HideHelpCommand = true appOptions := &server.Options{} diff --git a/version.go b/version.go index ab7b913..b690bc7 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,3 @@ package main var Version = "unknown_version" -var CommitID = "unknown_commit"