diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-01 22:12:05 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-02 11:00:17 +0900 |
commit | 649a42f47c2c39112b54d565fc8f21b96223226d (patch) | |
tree | df3aebb8ace2c23aa0ca9f9170c9954ff79e540f /gobgpd | |
parent | 26513c438e279b22a56ec9250395f3d0a0ea65b8 (diff) |
support version command line option
Preparation for binary release with:
https://github.com/goreleaser/goreleaser
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'gobgpd')
-rw-r--r-- | gobgpd/main.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 8b292caa..0c42878f 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -1,3 +1,4 @@ +// // Copyright (C) 2014-2017 Nippon Telegraph and Telephone Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +17,7 @@ package main import ( + "fmt" "io/ioutil" "net/http" _ "net/http/pprof" @@ -37,6 +39,8 @@ import ( "github.com/osrg/gobgp/table" ) +var version = "master" + func main() { sigCh := make(chan os.Signal, 1) signal.Notify(sigCh, syscall.SIGTERM) @@ -58,12 +62,18 @@ func main() { TLS bool `long:"tls" description:"enable TLS authentication for gRPC API"` TLSCertFile string `long:"tls-cert-file" description:"The TLS cert file"` TLSKeyFile string `long:"tls-key-file" description:"The TLS key file"` + Version bool `long:"version" description:"show version number"` } _, err := flags.Parse(&opts) if err != nil { os.Exit(1) } + if opts.Version { + fmt.Println("gobgpd version", version) + os.Exit(0) + } + if opts.CPUs == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } else { |