Skip to content

Commit

Permalink
cmd/go: vet: provide package ID to the vet tool
Browse files Browse the repository at this point in the history
This field, which matches the IDs used by go list, will enable all vet
drivers to produce JSON output in a consistent format (a map from
package ID to analysis name to result).

Change-Id: Icac703b944de55df42c996dc2f672005014ad57a
Reviewed-on: https://go-review.googlesource.com/c/149960
Reviewed-by: Russ Cox <rsc@golang.org>
  • Loading branch information
adonovan committed Nov 16, 2018
1 parent 2a07c50 commit 35244d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cmd/go/internal/work/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ func (b *Builder) loadCachedSrcFiles(a *Action) bool {

// vetConfig is the configuration passed to vet describing a single package.
type vetConfig struct {
ID string // package ID (example: "fmt [fmt.test]")
Compiler string // compiler name (gc, gccgo)
Dir string // directory containing package
ImportPath string // canonical import path ("package path")
Expand Down Expand Up @@ -914,6 +915,7 @@ func buildVetConfig(a *Action, srcfiles []string) {
// so that we can reformat them relative to the directory
// in which the go command is invoked.
vcfg := &vetConfig{
ID: a.Package.ImportPath,
Compiler: cfg.BuildToolchainName,
Dir: a.Package.Dir,
GoFiles: mkAbsFiles(a.Package.Dir, gofiles),
Expand Down

0 comments on commit 35244d8

Please sign in to comment.