mirror of
https://github.com/mgechev/revive.git
synced 2025-11-27 22:18:41 +02:00
Fix exit codes
This commit is contained in:
7
main.go
7
main.go
@@ -35,7 +35,7 @@ func main() {
|
|||||||
var config = lint.RulesConfig{
|
var config = lint.RulesConfig{
|
||||||
"argument-limit": lint.RuleConfig{
|
"argument-limit": lint.RuleConfig{
|
||||||
Arguments: []string{"3"},
|
Arguments: []string{"3"},
|
||||||
Severity: lint.SeverityWarning,
|
Severity: lint.SeverityError,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,9 +59,12 @@ func main() {
|
|||||||
|
|
||||||
exitCode := 0
|
exitCode := 0
|
||||||
for f := range failures {
|
for f := range failures {
|
||||||
if c, ok := config[f.RuleName]; ok && c.Severity == lint.SeverityError {
|
if exitCode == 0 {
|
||||||
exitCode = 1
|
exitCode = 1
|
||||||
}
|
}
|
||||||
|
if c, ok := config[f.RuleName]; ok && c.Severity == lint.SeverityError {
|
||||||
|
exitCode = 2
|
||||||
|
}
|
||||||
formatChan <- f
|
formatChan <- f
|
||||||
}
|
}
|
||||||
close(formatChan)
|
close(formatChan)
|
||||||
|
|||||||
Reference in New Issue
Block a user