Skip to content

Commit

Permalink
[+] add build commit, date to --version output, closes #256 (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub authored Sep 24, 2024
1 parent 0b0fb6a commit 80f78be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 80f78be

Please sign in to comment.