diff --git a/cmd/golangci-lint/main.go b/cmd/golangci-lint/main.go index c383f93e..413e071d 100644 --- a/cmd/golangci-lint/main.go +++ b/cmd/golangci-lint/main.go @@ -22,7 +22,7 @@ func main() { info := createBuildInfo() if err := commands.Execute(info); err != nil { - _, _ = fmt.Fprintf(os.Stderr, "failed executing command with error %v\n", err) + _, _ = fmt.Fprintf(os.Stderr, "Failed executing command with error: %v\n", err) os.Exit(exitcodes.Failure) } } diff --git a/pkg/commands/custom.go b/pkg/commands/custom.go index 1241aad9..dd7b1bb2 100644 --- a/pkg/commands/custom.go +++ b/pkg/commands/custom.go @@ -1,7 +1,6 @@ package commands import ( - "context" "fmt" "log" "os" @@ -27,7 +26,7 @@ func newCustomCommand(logger logutils.Log) *customCommand { customCmd := &cobra.Command{ Use: "custom", - Short: "Build a version of golangci-lint with custom linters.", + Short: "Build a version of golangci-lint with custom linters", Args: cobra.NoArgs, PreRunE: c.preRunE, RunE: c.runE, @@ -54,9 +53,7 @@ func (c *customCommand) preRunE(_ *cobra.Command, _ []string) error { return nil } -func (c *customCommand) runE(_ *cobra.Command, _ []string) error { - ctx := context.Background() - +func (c *customCommand) runE(cmd *cobra.Command, _ []string) error { tmp, err := os.MkdirTemp(os.TempDir(), "custom-gcl") if err != nil { return fmt.Errorf("create temporary directory: %w", err) @@ -72,7 +69,7 @@ func (c *customCommand) runE(_ *cobra.Command, _ []string) error { _ = os.RemoveAll(tmp) }() - err = internal.NewBuilder(c.log, c.cfg, tmp).Build(ctx) + err = internal.NewBuilder(c.log, c.cfg, tmp).Build(cmd.Context()) if err != nil { return fmt.Errorf("build process: %w", err) }