go/analysis/internal/unitchecker: three fixes
- add a no-op -tags flag for legacy compatibility. Tags processing is done by go vet, but it passes the flag on. Exercised by cmd/go TestGoVetWithTags. - rename OtherFiles to NonGoFiles in the JSON *.cfg file, to match the name actually used for this field (see github.com/golang/go/issues/27665). We really need to publish the types for this protocol. Exercised by cmd/go TestScript/vet_asm. - suppress diagnostics in cfg.VetxOnly mode. Exercised by cmd/go TestTestVet. Change-Id: I63259f1bd01531d110362e38190a220389b2ec4b Reviewed-on: https://go-review.googlesource.com/c/149608 Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
103f3f3613
commit
1fdeb1692e
|
@ -96,6 +96,7 @@ func main() {
|
||||||
for _, name := range []string{"source", "v", "all"} {
|
for _, name := range []string{"source", "v", "all"} {
|
||||||
_ = flag.Bool(name, false, "no effect (deprecated)")
|
_ = flag.Bool(name, false, "no effect (deprecated)")
|
||||||
}
|
}
|
||||||
|
_ = flag.String("tags", "", "no effect (deprecated)")
|
||||||
|
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Fprintln(os.Stderr, `Usage of vet:
|
fmt.Fprintln(os.Stderr, `Usage of vet:
|
||||||
|
|
|
@ -58,7 +58,7 @@ type Config struct {
|
||||||
Dir string
|
Dir string
|
||||||
ImportPath string
|
ImportPath string
|
||||||
GoFiles []string
|
GoFiles []string
|
||||||
OtherFiles []string // TODO(adonovan): make go vet populate this (github.com/golang/go/issues/27665)
|
NonGoFiles []string
|
||||||
ImportMap map[string]string
|
ImportMap map[string]string
|
||||||
PackageFile map[string]string
|
PackageFile map[string]string
|
||||||
Standard map[string]bool
|
Standard map[string]bool
|
||||||
|
@ -82,7 +82,7 @@ func Main(configFile string, analyzers []*analysis.Analyzer) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(diags) > 0 {
|
if !cfg.VetxOnly && len(diags) > 0 {
|
||||||
for _, diag := range diags {
|
for _, diag := range diags {
|
||||||
fmt.Fprintf(os.Stderr, "%s: %s\n", fset.Position(diag.Pos), diag.Message)
|
fmt.Fprintf(os.Stderr, "%s: %s\n", fset.Position(diag.Pos), diag.Message)
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]an
|
||||||
Analyzer: a,
|
Analyzer: a,
|
||||||
Fset: fset,
|
Fset: fset,
|
||||||
Files: files,
|
Files: files,
|
||||||
OtherFiles: cfg.OtherFiles,
|
OtherFiles: cfg.NonGoFiles,
|
||||||
Pkg: pkg,
|
Pkg: pkg,
|
||||||
TypesInfo: info,
|
TypesInfo: info,
|
||||||
ResultOf: inputs,
|
ResultOf: inputs,
|
||||||
|
|
Loading…
Reference in New Issue