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>
diff --git a/go/analysis/cmd/vet-lite/main.go b/go/analysis/cmd/vet-lite/main.go
index b4b0e63..e847d8d 100644
--- a/go/analysis/cmd/vet-lite/main.go
+++ b/go/analysis/cmd/vet-lite/main.go
@@ -96,6 +96,7 @@
 	for _, name := range []string{"source", "v", "all"} {
 		_ = flag.Bool(name, false, "no effect (deprecated)")
 	}
+	_ = flag.String("tags", "", "no effect (deprecated)")
 
 	flag.Usage = func() {
 		fmt.Fprintln(os.Stderr, `Usage of vet:
diff --git a/go/analysis/internal/unitchecker/unitchecker.go b/go/analysis/internal/unitchecker/unitchecker.go
index 32b50c1..8ca42ab 100644
--- a/go/analysis/internal/unitchecker/unitchecker.go
+++ b/go/analysis/internal/unitchecker/unitchecker.go
@@ -58,7 +58,7 @@
 	Dir                       string
 	ImportPath                string
 	GoFiles                   []string
-	OtherFiles                []string // TODO(adonovan): make go vet populate this (github.com/golang/go/issues/27665)
+	NonGoFiles                []string
 	ImportMap                 map[string]string
 	PackageFile               map[string]string
 	Standard                  map[string]bool
@@ -82,7 +82,7 @@
 		log.Fatal(err)
 	}
 
-	if len(diags) > 0 {
+	if !cfg.VetxOnly && len(diags) > 0 {
 		for _, diag := range diags {
 			fmt.Fprintf(os.Stderr, "%s: %s\n", fset.Position(diag.Pos), diag.Message)
 		}
@@ -250,7 +250,7 @@
 				Analyzer:          a,
 				Fset:              fset,
 				Files:             files,
-				OtherFiles:        cfg.OtherFiles,
+				OtherFiles:        cfg.NonGoFiles,
 				Pkg:               pkg,
 				TypesInfo:         info,
 				ResultOf:          inputs,