mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-06 23:00:09 +09:00
tools/bump: resolve go.mod targets before calling go get
`go get -u` takes the highest semver the proxy offers: a fork's stray tag sorting above its real branch, or a module that has moved and kept tagging under the old path. Resolving first refuses both, and names the compare link for every version that does move.
This commit is contained in:
+15
-3
@@ -142,7 +142,7 @@ func sqliteAtom(ctx context.Context, r *repo) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
latest, err := latestVersion(ctx, modSqlite)
|
||||
latest, err := latestVersion(ctx, modSqlite, before)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%w: %w", errNoLockstepSource, err)
|
||||
}
|
||||
@@ -205,7 +205,19 @@ func moduleAtom(path string) func(context.Context, *repo) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err := r.nixRun(ctx, "go", "get", "-u", path); err != nil { //nolint:noinlineerr
|
||||
// Resolve the target here rather than letting `go get -u` choose it.
|
||||
// The go command takes the highest semver it is offered, which is how
|
||||
// a stray tag on a fork ends up committed.
|
||||
want, err := latestVersion(ctx, path, before)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if want == before {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
if _, err := r.nixRun(ctx, "go", "get", "-u", path+"@"+want); err != nil { //nolint:noinlineerr
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -218,7 +230,7 @@ func moduleAtom(path string) func(context.Context, *repo) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s %s -> %s", path, before, after), nil
|
||||
return describeChange(path, before, after), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user