Skip to content

Commit

Permalink
Moves version.go to pkg/version
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Harsha Voora <[email protected]>
  • Loading branch information
krishvoor committed Jul 21, 2023
1 parent d21fefd commit e68d9ce
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions cmd/ingress-perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
},
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
35 changes: 35 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e68d9ce

Please sign in to comment.