Skip to content

Commit

Permalink
Make -set-exit-status compatible with multiple paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcornelissen authored and jgautheron committed Sep 20, 2020
1 parent a6a8cb5 commit 8f5268c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/goconst/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,23 @@ func main() {
usage(os.Stderr)
os.Exit(1)
}

lintFailed := false
for _, path := range args {
anyIssues, err := run(path)
if err != nil {
log.Println(err)
os.Exit(1)
}

if anyIssues && *flagSetExitStatus {
os.Exit(2)
if anyIssues {
lintFailed = true
}
}

if lintFailed && *flagSetExitStatus {
os.Exit(2)
}
}

func run(path string) (bool, error) {
Expand Down

0 comments on commit 8f5268c

Please sign in to comment.