lintutil: validate formatter before linting
Closes: [via git-merge-pr]
@@ -239,19 +239,6 @@ func ProcessFlagSet(cs []*analysis.Analyzer, cums []lint.CumulativeChecker, fs *
exit(0)
}
- ps, err := Lint(cs, cums, fs.Args(), &Options{
- Tags: tags,
- LintTests: tests,
- GoVersion: goVersion,
- Config: cfg,
- PrintAnalyzerMeasurement: measureAnalyzers,
- RepeatAnalyzers: debugRepeat,
- })
- if err != nil {
- fmt.Fprintln(os.Stderr, err)
- exit(1)
- }
-
var f format.Formatter
switch formatter {
case "text":
@@ -265,6 +252,19 @@ func ProcessFlagSet(cs []*analysis.Analyzer, cums []lint.CumulativeChecker, fs *
exit(2)
}
+ ps, err := Lint(cs, cums, fs.Args(), &Options{
+ Tags: tags,
+ LintTests: tests,
+ GoVersion: goVersion,
+ Config: cfg,
+ PrintAnalyzerMeasurement: measureAnalyzers,
+ RepeatAnalyzers: debugRepeat,
+ })
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ exit(1)
+ }
+
var (
total int
errors int
