summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--VERSION1
-rw-r--r--gobgp/main.go8
-rw-r--r--gobgpd/main.go10
3 files changed, 18 insertions, 1 deletions
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 0f6abf48..00000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.21 \ No newline at end of file
diff --git a/gobgp/main.go b/gobgp/main.go
index ce4abf96..2d821b0a 100644
--- a/gobgp/main.go
+++ b/gobgp/main.go
@@ -16,11 +16,19 @@
package main
import (
+ "fmt"
"github.com/osrg/gobgp/gobgp/cmd"
"google.golang.org/grpc"
+ "os"
)
+var version = "master"
+
func main() {
+ if len(os.Args) > 1 && os.Args[1] == "--version" {
+ fmt.Println("gobgp version", version)
+ os.Exit(0)
+ }
grpc.EnableTracing = false
cmd.NewRootCmd().Execute()
}
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 {