Skip to content

Commit 87b66ae

Browse files
committed
correct exit code
1 parent d341623 commit 87b66ae

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

cmd/checker/main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
var (
1515
// Store the number of validation errors
16-
validationErrorCount uint = 0
16+
errCount uint = 0
1717
)
1818

1919
func main() {
@@ -30,15 +30,18 @@ func main() {
3030
if subcommand == "lint" {
3131
lintPackage(flag.Arg(1))
3232

33-
if validationErrorCount > 0 {
34-
fmt.Printf("%d linting error(s)\n", validationErrorCount)
33+
if errCount > 0 {
3534
os.Exit(1)
3635
}
3736
return
3837
}
3938

4039
if subcommand == "show-files" {
4140
showFiles(flag.Arg(1))
41+
42+
if errCount > 0 {
43+
os.Exit(1)
44+
}
4245
return
4346
}
4447

@@ -128,7 +131,7 @@ func lintPackage(path string) {
128131

129132
func err(ctx context.Context, s string) {
130133
util.Printf(ctx, "error: "+s)
131-
validationErrorCount += 1
134+
errCount += 1
132135
}
133136

134137
func warn(ctx context.Context, s string) {

0 commit comments

Comments
 (0)