tools/bump: refuse a batch that moves a requirement backwards

Diffing go.mod catches a downgrade wherever selection produced it;
reading what go get printed only catches what go get did itself. The
lockstep partners are exempt, since repin lowers them on purpose.
This commit is contained in:
Kristoffer Dalby
2026-09-23 07:28:08 +00:00
parent 823db85509
commit 731b0b963c
3 changed files with 117 additions and 1 deletions
+16 -1
View File
@@ -68,6 +68,11 @@ func applyAtoms(ctx context.Context, r *repo, atoms []atom) ([]string, []dropped
// applySet applies every atom, settles go.mod and asks the atom gate whether
// the result is viable.
func applySet(ctx context.Context, r *repo, atoms []atom) ([]string, error) {
before, err := parseGoMod(r)
if err != nil {
return nil, err
}
summaries := make([]string, 0, len(atoms))
for _, a := range atoms {
@@ -83,7 +88,17 @@ func applySet(ctx context.Context, r *repo, atoms []atom) ([]string, error) {
}
}
err := settle(ctx, r)
err = settle(ctx, r)
if err != nil {
return nil, err
}
after, err := parseGoMod(r)
if err != nil {
return nil, err
}
err = checkDowngrades(before, after)
if err != nil {
return nil, err
}