mirror of
https://github.com/golang/go.git
synced 2025-05-18 22:04:38 +00:00
cmd/go: add IgnoredOtherFiles to go list; pass IgnoredFiles to vet
Show constraint-ignored non-.go files in go list, as Package.IgnoredOtherFiles (same as go/build's IgnoredOtherFiles). Pass full list of ignored files to vet, to help buildtag checker. For #41184. Change-Id: I749868de9082cbbc1efbc59370783c8c82fe735f Reviewed-on: https://go-review.googlesource.com/c/go/+/240553 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
8b289a15e4
commit
7b77ff4c88
@ -79,6 +79,7 @@ type PackagePublic struct {
|
||||
CgoFiles []string `json:",omitempty"` // .go source files that import "C"
|
||||
CompiledGoFiles []string `json:",omitempty"` // .go output from running cgo on CgoFiles
|
||||
IgnoredGoFiles []string `json:",omitempty"` // .go source files ignored due to build constraints
|
||||
IgnoredOtherFiles []string `json:",omitempty"` // non-.go source files ignored due to build constraints
|
||||
CFiles []string `json:",omitempty"` // .c source files
|
||||
CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files
|
||||
MFiles []string `json:",omitempty"` // .m source files
|
||||
@ -127,6 +128,7 @@ func (p *Package) AllFiles() []string {
|
||||
p.CgoFiles,
|
||||
// no p.CompiledGoFiles, because they are from GoFiles or generated by us
|
||||
p.IgnoredGoFiles,
|
||||
p.IgnoredOtherFiles,
|
||||
p.CFiles,
|
||||
p.CXXFiles,
|
||||
p.MFiles,
|
||||
@ -330,6 +332,7 @@ func (p *Package) copyBuild(pp *build.Package) {
|
||||
p.GoFiles = pp.GoFiles
|
||||
p.CgoFiles = pp.CgoFiles
|
||||
p.IgnoredGoFiles = pp.IgnoredGoFiles
|
||||
p.IgnoredOtherFiles = pp.IgnoredOtherFiles
|
||||
p.CFiles = pp.CFiles
|
||||
p.CXXFiles = pp.CXXFiles
|
||||
p.MFiles = pp.MFiles
|
||||
|
@ -928,6 +928,7 @@ type vetConfig struct {
|
||||
ImportPath string // canonical import path ("package path")
|
||||
GoFiles []string // absolute paths to package source files
|
||||
NonGoFiles []string // absolute paths to package non-Go files
|
||||
IgnoredFiles []string // absolute paths to ignored source files
|
||||
|
||||
ImportMap map[string]string // map import path in source code to package path
|
||||
PackageFile map[string]string // map package path to .a file with export data
|
||||
@ -951,6 +952,8 @@ func buildVetConfig(a *Action, srcfiles []string) {
|
||||
}
|
||||
}
|
||||
|
||||
ignored := str.StringList(a.Package.IgnoredGoFiles, a.Package.IgnoredOtherFiles)
|
||||
|
||||
// Pass list of absolute paths to vet,
|
||||
// so that vet's error messages will use absolute paths,
|
||||
// so that we can reformat them relative to the directory
|
||||
@ -961,6 +964,7 @@ func buildVetConfig(a *Action, srcfiles []string) {
|
||||
Dir: a.Package.Dir,
|
||||
GoFiles: mkAbsFiles(a.Package.Dir, gofiles),
|
||||
NonGoFiles: mkAbsFiles(a.Package.Dir, nongofiles),
|
||||
IgnoredFiles: mkAbsFiles(a.Package.Dir, ignored),
|
||||
ImportPath: a.Package.ImportPath,
|
||||
ImportMap: make(map[string]string),
|
||||
PackageFile: make(map[string]string),
|
||||
|
Loading…
x
Reference in New Issue
Block a user