From 7e0e662c342076e203c92628d259b33478807a05 Mon Sep 17 00:00:00 2001 From: Tomasz Smelcerz Date: Tue, 7 Nov 2023 16:07:52 +0100 Subject: [PATCH] Support for build version --- runtime-watcher/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime-watcher/main.go b/runtime-watcher/main.go index 0f331f63..6e0394cf 100644 --- a/runtime-watcher/main.go +++ b/runtime-watcher/main.go @@ -34,7 +34,7 @@ import ( "github.com/kyma-project/runtime-watcher/skr/internal/serverconfig" ) -var buildVersion string = "not-provided" +var buildVersion = "not-provided" func main() { var printVersion bool @@ -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)))