Skip to content

Commit 1fdeb16

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 103f3f3 commit 1fdeb16

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

go/analysis/cmd/vet-lite/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func main() {
9696
for _, name := range []string{"source", "v", "all"} {
9797
_ = flag.Bool(name, false, "no effect (deprecated)")
9898
}
99+
_ = flag.String("tags", "", "no effect (deprecated)")
99100

100101
flag.Usage = func() {
101102
fmt.Fprintln(os.Stderr, `Usage of vet:

go/analysis/internal/unitchecker/unitchecker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Config struct {
5858
Dir string
5959
ImportPath string
6060
GoFiles []string
61-
OtherFiles []string // TODO(adonovan): make go vet populate this (github.com/golang/go/issues/27665)
61+
NonGoFiles []string
6262
ImportMap map[string]string
6363
PackageFile map[string]string
6464
Standard map[string]bool
@@ -82,7 +82,7 @@ func Main(configFile string, analyzers []*analysis.Analyzer) {
8282
log.Fatal(err)
8383
}
8484

85-
if len(diags) > 0 {
85+
if !cfg.VetxOnly && len(diags) > 0 {
8686
for _, diag := range diags {
8787
fmt.Fprintf(os.Stderr, "%s: %s\n", fset.Position(diag.Pos), diag.Message)
8888
}
@@ -250,7 +250,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]an
250250
Analyzer: a,
251251
Fset: fset,
252252
Files: files,
253-
OtherFiles: cfg.OtherFiles,
253+
OtherFiles: cfg.NonGoFiles,
254254
Pkg: pkg,
255255
TypesInfo: info,
256256
ResultOf: inputs,

0 commit comments

Comments
 (0)