Skip to content

Commit

Permalink
Support for build version
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz-Smelcerz-SAP committed Nov 7, 2023
1 parent acb1f06 commit 7e0e662
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions runtime-watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/kyma-project/runtime-watcher/skr/internal/serverconfig"
)

var buildVersion string = "not-provided"
var buildVersion = "not-provided"

Check failure on line 37 in runtime-watcher/main.go

View workflow job for this annotation

GitHub Actions / lint-build-test

buildVersion is a global variable (gochecknoglobals)

func main() {
var printVersion bool
Expand All @@ -48,8 +48,12 @@ func main() {
flag.Parse()

if printVersion {
fmt.Printf("Runtime Watcher version: %s\n", buildVersion)
os.Exit(1)
msg := fmt.Sprintf("Runtime Watcher version: %s\n", buildVersion)
_, err := os.Stdout.WriteString(msg)
if err != nil {
os.Exit(1)
}
os.Exit(0)
}

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
Expand Down

0 comments on commit 7e0e662

Please sign in to comment.