Skip to content

Commit

Permalink
chore: Better code style
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Kiselev <[email protected]>
  • Loading branch information
mrexox committed Jun 13, 2022
1 parent 7b6c3e2 commit 3e6c8ec
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/lefthook/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,14 @@ func (r *Runner) runScript(script *config.Script, path string, file os.FileInfo)
}

func (r *Runner) runCommands() {
var wg sync.WaitGroup

commands := make([]string, 0, len(r.hook.Commands))
for name := range r.hook.Commands {
commands = append(commands, name)
}

sort.Strings(commands)

var wg sync.WaitGroup
for _, name := range commands {
if r.failed && r.hook.Piped {
logSkip(name, "(SKIP BY BROKEN PIPE)")
Expand Down Expand Up @@ -306,6 +305,6 @@ func intersect(a, b []string) bool {
return false
}

func logSkip(name, skipMsg string) {
log.Info(fmt.Sprintf("%s: %s", log.Bold(name), log.Yellow(skipMsg)))
func logSkip(name, reason string) {
log.Info(fmt.Sprintf("%s: %s", log.Bold(name), log.Yellow(reason)))
}

0 comments on commit 3e6c8ec

Please sign in to comment.