update latest version check

This commit is contained in:
Daniel-GrunbergerCA
2021-09-09 14:58:52 +03:00
parent 8375a8ae63
commit 08a81696a1
2 changed files with 13 additions and 14 deletions
+2 -13
View File
@@ -12,7 +12,7 @@ import (
var (
sha1ver string
buildTime string
run_number string
Run_number string
)
// versionCmd represents the version command
@@ -21,18 +21,7 @@ var versionCmd = &cobra.Command{
Short: "Get current version",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(sha1ver)
fmt.Println(buildTime)
latest, err := GetLatestVersion()
if err != nil {
return err
}
fmt.Println(latest)
if latest == run_number {
fmt.Println("Updated")
} else {
fmt.Println("Not updated")
}
fmt.Println("Your current version is: " + Run_number)
return nil
},
}
+11 -1
View File
@@ -1,10 +1,20 @@
package main
import (
"fmt"
"github.com/armosec/kubescape/cmd"
)
func main() {
CheckLatestVersion()
cmd.Execute()
}
func CheckLatestVersion() {
latest, _ := cmd.GetLatestVersion()
if latest != cmd.Run_number {
fmt.Println("Warning: You are not updated to the latest release: " + latest)
}
}