| 630 | } |
| 631 | |
| 632 | func LintActionFunc(ctx context.Context, cmd *cli.Command) error { |
| 633 | topDir := cmd.String("top-dir") |
| 634 | if err := os.Chdir(topDir); err != nil { |
| 635 | return err |
| 636 | } |
| 637 | |
| 638 | out, err := sh(ctx, filepath.Join(topDir, ".local/bin/goimports"), "-l", ".") |
| 639 | if err != nil { |
| 640 | return err |
| 641 | } |
| 642 | |
| 643 | if strings.TrimSpace(out) != "" { |
| 644 | fmt.Fprintln(cmd.ErrWriter, "# ---> goimports -l is non-empty:") |
| 645 | fmt.Fprintln(cmd.ErrWriter, out) |
| 646 | |
| 647 | return errors.New("goimports needed") |
| 648 | } |
| 649 | |
| 650 | return nil |
| 651 | } |
| 652 | |
| 653 | func V3Diff(ctx context.Context, cmd *cli.Command) error { |
| 654 | if err := os.Chdir(cmd.String("top-dir")); err != nil { |