Skip to content

Commit

Permalink
add build version
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalBlueberry committed Dec 8, 2020
1 parent 936e705 commit b6ac535
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/chkb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
export VERSION=$(git describe --dirty)
go build -ldflags="-X 'main.Version=$VERSION'"
8 changes: 7 additions & 1 deletion cmd/chkb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import (
evdev "github.com/gvalkov/golang-evdev"
)

var (
Version = "development"
)

func main() {
var (
verbose bool
Expand All @@ -27,7 +31,9 @@ func main() {
flag.Parse()
if verbose {
log.SetLevel(log.DebugLevel)
log.Debug("Set debug level")
log.
WithField("Version", Version).
Debug("Set debug level")
}

dev, err := evdev.Open(flag.Arg(0))
Expand Down

0 comments on commit b6ac535

Please sign in to comment.