mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-24 23:36:49 +09:00
tools/bump: reformat inside the lock bump
gateFlake judges the formatting check right after the lock moves, but the fmt area runs last, so the new toolchain's formatting had not been applied yet and the flake area dropped itself every run.
This commit is contained in:
1 parent
8d89742a21
commit
f1186d8e00
2 files changed
+25
-7
No files matched your search
+16
-7
@@ -140,13 +140,7 @@ func gateGenerate(ctx context.Context, r *repo) error {
|
||||
// The first hook pass is expected to fail, because a hook that rewrites a file
|
||||
// reports failure. The second pass is the real verdict.
|
||||
func applyFormat(ctx context.Context, r *repo) (change, error) {
|
||||
if _, err := r.nixRun(ctx, "make", "fmt"); err != nil { //nolint:noinlineerr
|
||||
return change{}, err
|
||||
}
|
||||
|
||||
_, _ = r.nixRun(ctx, "prek", "run", "--all-files")
|
||||
|
||||
if _, err := r.nixRun(ctx, "prek", "run", "--all-files"); err != nil { //nolint:noinlineerr
|
||||
if err := runFormatters(ctx, r); err != nil { //nolint:noinlineerr
|
||||
return change{}, err
|
||||
}
|
||||
|
||||
@@ -164,3 +158,18 @@ func applyFormat(ctx context.Context, r *repo) (change, error) {
|
||||
Detail: touched,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// runFormatters brings the tree up to whatever the current toolchain considers
|
||||
// formatted. The first hook pass is expected to fail, because a hook that
|
||||
// rewrites a file reports failure; the second pass is the verdict.
|
||||
func runFormatters(ctx context.Context, r *repo) error {
|
||||
if _, err := r.nixRun(ctx, "make", "fmt"); err != nil { //nolint:noinlineerr
|
||||
return err
|
||||
}
|
||||
|
||||
_, _ = r.nixRun(ctx, "prek", "run", "--all-files")
|
||||
|
||||
_, err := r.nixRun(ctx, "prek", "run", "--all-files")
|
||||
|
||||
return err
|
||||
}
|
||||
Reference in new issue
Block a user