From e68d9ce3d769d30339fafc83a4d4aa9abcfbccb4 Mon Sep 17 00:00:00 2001 From: Krishna Harsha Voora Date: Fri, 21 Jul 2023 11:28:10 +0530 Subject: [PATCH] Moves version.go to pkg/version Signed-off-by: Krishna Harsha Voora --- Makefile | 2 +- cmd/ingress-perf.go | 8 ++++++-- go.mod | 1 - go.sum | 2 -- pkg/version/version.go | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 pkg/version/version.go diff --git a/Makefile b/Makefile index 173339c..987c45e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ endif SOURCES := $(shell find . -type f -name "*.go") BUILD_DATE = $(shell date '+%Y-%m-%d-%H:%M:%S') -INGRESS_PERF_VERSION= github.com/cloud-bulldozer/kube-burner/pkg/version +INGRESS_PERF_VERSION= github.com/cloud-bulldozer/ingress-perf/pkg/version BIN_DIR = bin BIN_NAME = ingress-perf diff --git a/cmd/ingress-perf.go b/cmd/ingress-perf.go index 9e4f380..0232461 100644 --- a/cmd/ingress-perf.go +++ b/cmd/ingress-perf.go @@ -21,7 +21,7 @@ import ( "github.com/cloud-bulldozer/ingress-perf/pkg/config" _ "github.com/cloud-bulldozer/ingress-perf/pkg/log" "github.com/cloud-bulldozer/ingress-perf/pkg/runner" - "github.com/cloud-bulldozer/kube-burner/pkg/version" + "github.com/cloud-bulldozer/ingress-perf/pkg/version" uid "github.com/satori/go.uuid" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" @@ -36,7 +36,11 @@ var versionCmd = &cobra.Command{ Use: "version", Short: "😎 Print the version number of ingress-perf", Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("%s@%s \n", version.Version, version.GitCommit) + fmt.Println("Version:", version.Version) + fmt.Println("Git Commit:", version.GitCommit) + fmt.Println("Build Date:", version.BuildDate) + fmt.Println("Go Version:", version.GoVersion) + fmt.Println("OS/Arch:", version.OsArch) }, } diff --git a/go.mod b/go.mod index eb4562c..e5782ed 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.19 require ( github.com/cloud-bulldozer/go-commons v1.0.9 - github.com/cloud-bulldozer/kube-burner v1.7.3 github.com/openshift/api v0.0.0-20230414095907-0540dde8186d github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c github.com/satori/go.uuid v1.2.0 diff --git a/go.sum b/go.sum index f414068..fb8b0d3 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloud-bulldozer/go-commons v1.0.9 h1:JNLcC36kk6Iml0JuBXUSyi8iR+ebgCeMWQScwnSUekw= github.com/cloud-bulldozer/go-commons v1.0.9/go.mod h1:peHBEG4iCC9zKFzA4P16dpINZASWshsCy9T4dVpcBVI= -github.com/cloud-bulldozer/kube-burner v1.7.3 h1:CO+fk6HGjoBfT4pTQGjfiwRd23Fo5isUp7JUXpHhDT0= -github.com/cloud-bulldozer/kube-burner v1.7.3/go.mod h1:NnqtBx6cW53zlVf65Mv2U43hDlc/VF0FquFmjUeySV4= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/pkg/version/version.go b/pkg/version/version.go new file mode 100644 index 0000000..a6b4dfd --- /dev/null +++ b/pkg/version/version.go @@ -0,0 +1,35 @@ +// Copyright 2020 The Kube-burner Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "runtime" +) + +// GitCommit returns the git commit that was compiled. This will be filled in by the compiler. +var GitCommit string + +// BuildDate returns the date the binary was built +var BuildDate = "" + +// Version returns the git tag that was compiled. This will be filled in by the compiler. +var Version = "" + +// GoVersion returns the version of the go runtime used to compile the binary +var GoVersion = runtime.Version() + +// OsArch returns the os and arch used to build the binary +var OsArch = fmt.Sprintf("%s %s", runtime.GOOS, runtime.GOARCH)