From 80f78bef288a63473d99848142e8ce9667648b08 Mon Sep 17 00:00:00 2001 From: Pavlo Golub Date: Tue, 24 Sep 2024 12:14:31 +0200 Subject: [PATCH] [+] add build `commit`, `date` to `--version` output, closes #256 (#258) --- Makefile | 2 +- main.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 48219d1..0368f58 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ GOENV=CGO_ENABLED=0 all: vip-manager vip-manager: *.go */*.go - $(GOENV) go build -ldflags="-s -w" . + $(GOENV) go build -ldflags="-s -w -X main.version=`git describe --tags --abbrev=0` -X main.commit=`git show -s --format=%H HEAD` -X main.date=`git show -s --format=%cI HEAD`" . install: install -d $(DESTDIR)/usr/bin diff --git a/main.go b/main.go index 7a0862a..6a226bc 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,9 @@ import ( var ( // vip-manager version definition - version = "2.4.0" + version = "master" + commit = "none" + date = "unknown" ) func getMask(vip netip.Addr, mask int) net.IPMask { @@ -48,6 +50,8 @@ func main() { // return nil, nil // } fmt.Printf("version: %s\n", version) + fmt.Printf("commit: %s\n", commit) + fmt.Printf("date: %s\n", date) return }