validate versions before running go get

This commit is contained in:
Jeff Carr 2025-01-08 04:07:53 -06:00
parent a6b802d0f4
commit 3adf184a4a
1 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"sort"
"strings"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@ -64,8 +65,11 @@ func cleanGoDepsCheckOk(check *gitpb.Repo) error {
depRepo.GetVersion(), found.GetMasterVersion(), ends)
errs := fmt.Sprintf("%s error %s vs %s %s", depRepo.GetGoPath(),
depRepo.GetVersion(), found.GetMasterVersion(), ends)
cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()}
fixes = append(fixes, cmd)
if ok, _ := forgepb.ValidGoVersion(found.GetMasterVersion()); ok {
// can't go get invalid version numbers
cmd := []string{"go", "get", depRepo.GetGoPath() + "@" + found.GetMasterVersion()}
fixes = append(fixes, cmd)
}
err = errors.New(errs)
}
}