MCPcopy
hub / github.com/urfave/cli / EnsureGoimportsActionFunc

Function EnsureGoimportsActionFunc

scripts/build.go:548–566  ·  view source on GitHub ↗
(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

546}
547
548func 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
568func EnsureGfmrunActionFunc(ctx context.Context, cmd *cli.Command) error {
569 topDir := cmd.String("top-dir")

Callers

nothing calls this directly

Calls 2

runCmdFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected