adding -version flag back into app and probe for the release script

This commit is contained in:
Paul Bellamy
2015-08-19 10:36:55 +01:00
parent fc75b3dc58
commit 3fa86fe6ce
2 changed files with 15 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
"log"
"math/rand"
"net/http"
@@ -20,11 +21,17 @@ var version = "dev"
func main() {
var (
window = flag.Duration("window", 15*time.Second, "window")
listen = flag.String("http.address", ":"+strconv.Itoa(xfer.AppPort), "webserver listen address")
window = flag.Duration("window", 15*time.Second, "window")
listen = flag.String("http.address", ":"+strconv.Itoa(xfer.AppPort), "webserver listen address")
printVersion = flag.Bool("version", false, "print version number and exit")
)
flag.Parse()
if *printVersion {
fmt.Println(version)
return
}
rand.Seed(time.Now().UnixNano())
id := strconv.FormatInt(rand.Int63(), 16)
log.Printf("app starting, version %s, ID %s", version, id)