Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func setupCheckCommand() *cobraext.Command {
Short: "Check the package",
Long: checkLongDescription,
RunE: func(cmd *cobra.Command, args []string) error {
err := cobraext.ComposeCommandActions(cmd, args,
formatCommandAction,
lintCommandAction,
buildCommandAction,
err := cobraext.ComposeCommands(args,
setupFormatCommand(),
setupLintCommand(),
setupBuildCommand(),
)
if err != nil {
return errors.Wrap(err, "checking package failed")
Expand Down
11 changes: 11 additions & 0 deletions internal/cobraext/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ func ComposeCommandActions(cmd *cobra.Command, args []string, actions ...Command
}
return nil
}

// ComposeCommands runs given commands in order
func ComposeCommands(args []string, composed ...*Command) error {
for _, cmd := range composed {
err := cmd.RunE(cmd.Command, args)
if err != nil {
return err
}
}
return nil
}