lint: warn when patterns matched no packages
Updates
@@ -4,6 +4,7 @@ package lint // import "honnef.co/go/tools/lint"
import (
"fmt"
"go/token"
+ "os"
"path/filepath"
"regexp"
"sort"
@@ -306,6 +307,12 @@ func (l *Linter) Lint(cfg *packages.Config, patterns []string) ([]Problem, error
return nil, err
}
+ if len(results) == 0 && err == nil {
+ // TODO(dh): emulate Go's behavior more closely once we have
+ // access to go list's Match field.
+ fmt.Fprintf(os.Stderr, "warning: %q matched no packages\n", patterns)
+ }
+
analyzerNames := make([]string, len(l.Checkers))
for i, a := range l.Checkers {
analyzerNames[i] = a.Name
