Skip to content

Commit

Permalink
includes build version and time (fix #21).
Browse files Browse the repository at this point in the history
  • Loading branch information
fgeller committed Apr 23, 2016
1 parent c689d7f commit 286e7e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build: GOOS ?= darwin
build: GOARCH ?= amd64
build:
rm -f kt
GOOS=${GOOS} GOARCH=${GOARCH} go build .
GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X main.buildTime=`date --iso-8601=s` -X main.buildVersion=`git rev-parse HEAD | cut -c-7`" .

release-linux:
GOOS=linux $(MAKE) build
Expand Down
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"os/signal"
)

var buildVersion, buildTime string

var config struct {
consume consumeConfig
produce produceConfig
Expand All @@ -33,7 +35,7 @@ type command struct {
run func(chan struct{})
}

var usageMessage = `kt is a tool for Kafka.
var usageMessage = fmt.Sprintf(`kt is a tool for Kafka.
Usage:
Expand All @@ -47,7 +49,8 @@ The commands are:
Use "kt [command] -help" for for information about the command.
`
More at https://github.com/fgeller/kt
Build %v from %v.`, buildVersion, buildTime)

func usage() {
fmt.Fprintln(os.Stderr, usageMessage)
Expand Down

0 comments on commit 286e7e5

Please sign in to comment.