From 671dc0d94ab92e2b21e4643ce930efb0df4ccc6d Mon Sep 17 00:00:00 2001 From: Emil Palm Date: Fri, 10 May 2019 15:11:22 +0200 Subject: Add Versioning support --- cmd/gobgp/main.go | 5 ++--- cmd/gobgpd/main.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/gobgp/main.go b/cmd/gobgp/main.go index 41f95ab2..079b1d4a 100644 --- a/cmd/gobgp/main.go +++ b/cmd/gobgp/main.go @@ -19,14 +19,13 @@ import ( "fmt" "os" + "github.com/osrg/gobgp/internal/pkg/version" "google.golang.org/grpc" ) -var version = "master" - func main() { if len(os.Args) > 1 && os.Args[1] == "--version" { - fmt.Println("gobgp version", version) + fmt.Println("gobgp version", version.Version()) os.Exit(0) } grpc.EnableTracing = false diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 015b0a4b..7ad06434 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -39,12 +39,11 @@ import ( "github.com/osrg/gobgp/internal/pkg/apiutil" "github.com/osrg/gobgp/internal/pkg/config" "github.com/osrg/gobgp/internal/pkg/table" + "github.com/osrg/gobgp/internal/pkg/version" "github.com/osrg/gobgp/pkg/packet/bgp" "github.com/osrg/gobgp/pkg/server" ) -var version = "master" - func marshalRouteTargets(l []string) ([]*any.Any, error) { rtList := make([]*any.Any, 0, len(l)) for _, rtString := range l { @@ -132,7 +131,7 @@ func main() { } if opts.Version { - fmt.Println("gobgpd version", version) + fmt.Println("gobgpd version", version.Version()) os.Exit(0) } -- cgit v1.2.3