mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2024-12-19 13:18:07 +00:00
Fix bug causing kubectl version to always return default version.
This commit is contained in:
parent
42a1068964
commit
c60c459bc4
@ -232,7 +232,7 @@ func getKubeVersion() string {
|
||||
|
||||
serverVersionRe := regexp.MustCompile(`Server Version: v(\d+.\d+)`)
|
||||
subs := serverVersionRe.FindStringSubmatch(string(out))
|
||||
if len(subs) > 2 {
|
||||
if len(subs) == 2 {
|
||||
ver = string(subs[1])
|
||||
validVersionPttn := `\d.\d`
|
||||
if matched, _ = regexp.MatchString(validVersionPttn, ver); !matched {
|
||||
|
Loading…
Reference in New Issue
Block a user