File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ func init() {
4343 }
4444
4545 if versions .K0sVersion != "0.0.0" {
46+ // validate that the go mod dependency matches the K0S_VERSION specified at compile time
4647 if err := validateK0sVersion (k8sVersion ); err != nil {
4748 panic (err )
4849 }
@@ -59,7 +60,7 @@ func validateK0sVersion(k8sVersion *semver.Version) error {
5960 }
6061
6162 if sv .Major () != k8sVersion .Major () || sv .Minor () != k8sVersion .Minor () {
62- return fmt .Errorf ("k0s version %s does not match k8s dependency version %s" , sv .Original (), k8sVersion .Original ())
63+ return fmt .Errorf ("versions.K0sVersion %s does not match k0s go mod dependency version %s" , sv .Original (), k8sVersion .Original ())
6364 }
6465 return nil
6566}
@@ -72,7 +73,11 @@ func populateMetadataMap() error {
7273 if d .IsDir () {
7374 return nil
7475 }
75- minorVersion := metadataMinorRegex .FindStringSubmatch (d .Name ())[1 ]
76+ matches := metadataMinorRegex .FindStringSubmatch (d .Name ())
77+ if len (matches ) < 2 {
78+ return fmt .Errorf ("filename %s does not match expected metadata pattern" , d .Name ())
79+ }
80+ minorVersion := matches [1 ]
7681 var metadata release.K0sMetadata
7782 content , err := metadataFS .ReadFile (path )
7883 if err != nil {
You can’t perform that action at this time.
0 commit comments