Skip to content

Commit 80f78be

Browse files
authored
[+] add build commit, date to --version output, closes #256 (#258)
1 parent 0b0fb6a commit 80f78be

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GOENV=CGO_ENABLED=0
33
all: vip-manager
44

55
vip-manager: *.go */*.go
6-
$(GOENV) go build -ldflags="-s -w" .
6+
$(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`" .
77

88
install:
99
install -d $(DESTDIR)/usr/bin

main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import (
2020

2121
var (
2222
// vip-manager version definition
23-
version = "2.4.0"
23+
version = "master"
24+
commit = "none"
25+
date = "unknown"
2426
)
2527

2628
func getMask(vip netip.Addr, mask int) net.IPMask {
@@ -48,6 +50,8 @@ func main() {
4850
// return nil, nil
4951
// }
5052
fmt.Printf("version: %s\n", version)
53+
fmt.Printf("commit: %s\n", commit)
54+
fmt.Printf("date: %s\n", date)
5155
return
5256
}
5357

0 commit comments

Comments
 (0)