| 546 | } |
| 547 | |
| 548 | func EnsureGoimportsActionFunc(ctx context.Context, cmd *cli.Command) error { |
| 549 | topDir := cmd.String("top-dir") |
| 550 | if err := os.Chdir(topDir); err != nil { |
| 551 | return err |
| 552 | } |
| 553 | |
| 554 | if err := runCmd( |
| 555 | ctx, |
| 556 | "goimports", |
| 557 | "-d", |
| 558 | filepath.Join(topDir, "scripts/build.go"), |
| 559 | ); err == nil { |
| 560 | return nil |
| 561 | } |
| 562 | |
| 563 | os.Setenv("GOBIN", filepath.Join(topDir, ".local/bin")) |
| 564 | |
| 565 | return runCmd(ctx, "go", "install", "golang.org/x/tools/cmd/goimports@latest") |
| 566 | } |
| 567 | |
| 568 | func EnsureGfmrunActionFunc(ctx context.Context, cmd *cli.Command) error { |
| 569 | topDir := cmd.String("top-dir") |