Skip to content

Commit

Permalink
Include git commit id in VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Aug 31, 2012
1 parent 70b6e4e commit 369e353
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
#go get -v
go build -ldflags "-X main.gitVersion `git rev-parse --short=8 HEAD`" -v
go install
13 changes: 10 additions & 3 deletions geodns.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"time"
)

const VERSION = "2.0"
var VERSION string = "2.0"
var gitVersion string

var timeStarted = time.Now()
var qCounter uint64 = 0
Expand All @@ -23,13 +24,19 @@ var (
memprofile = flag.String("memprofile", "", "write memory profile to this file")
)

func main() {
func init() {
if len(gitVersion) > 0 {
VERSION = VERSION + "/" + gitVersion
}

log.SetPrefix("geodns ")
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
}

func main() {
flag.Parse()

log.Printf("Starting geodns/%s\n", VERSION)
log.Printf("Starting geodns %s\n", VERSION)

if *cpuprofile != "" {
prof, err := os.Create(*cpuprofile)
Expand Down

0 comments on commit 369e353

Please sign in to comment.