Skip to content

Commit

Permalink
Include runtime.GOOS and runtime.GOARCH in -version output
Browse files Browse the repository at this point in the history
  • Loading branch information
tsenart committed May 23, 2018
1 parent add59f4 commit 27e8bf5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
COMMIT=$(shell git rev-parse HEAD)
VERSION=$(shell git describe --tags --exact-match --always)
DATE=$(shell date +'%FT%TZ%z')

vegeta: vendor
go build -v -a -tags=netgo \
-ldflags '-s -w -extldflags "-static" -X main.Version=$(VERSION) -X main.Commit=$(COMMIT) -X main.Date=$(DATE)'

vendor:
dep ensure -v
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ func main() {
fs.Parse(os.Args[1:])

if *version {
fmt.Printf("Version: %s\nCommit: %s\nGo version: %s\nDate: %s\n", Version, Commit, runtime.Version(), Date)
fmt.Printf("Version: %s\nCommit: %s\nRuntime: %s %s/%s\nDate: %s\n",
Version,
Commit,
runtime.Version(),
runtime.GOOS,
runtime.GOARCH,
Date,
)
return
}

Expand Down

0 comments on commit 27e8bf5

Please sign in to comment.