{Name: "unusedstringmethods"},
}
+var vetTool string
+
// add build flags to vetFlagDefn.
func init() {
var cmd base.Command
work.AddBuildFlags(&cmd)
+ cmd.Flag.StringVar(&vetTool, "vettool", "", "path to vet tool binary") // for cmd/vet tests; undocumented for now
cmd.Flag.VisitAll(func(f *flag.Flag) {
vetFlagDefn = append(vetFlagDefn, &cmdflag.Defn{
Name: f.Name,
}
switch f.Name {
// Flags known to the build but not to vet, so must be dropped.
- case "x", "n":
- args = append(args[:i], args[i+1:]...)
+ case "x", "n", "vettool":
+ if extraWord {
+ args = append(args[:i], args[i+2:]...)
+ extraWord = false
+ } else {
+ args = append(args[:i], args[i+1:]...)
+ }
i--
}
}
Compiler: cfg.BuildToolchainName,
Dir: a.Package.Dir,
GoFiles: mkAbsFiles(a.Package.Dir, gofiles),
+ ImportPath: a.Package.ImportPath,
ImportMap: make(map[string]string),
PackageFile: make(map[string]string),
}
GoFiles []string
ImportMap map[string]string
PackageFile map[string]string
+ ImportPath string
SucceedOnTypecheckFailure bool
}
+// VetTool is the path to an alternate vet tool binary.
+// The caller is expected to set it (if needed) before executing any vet actions.
+var VetTool string
+
// VetFlags are the flags to pass to vet.
// The caller is expected to set them before executing any vet actions.
var VetFlags []string
}
p := a.Package
- return b.run(a, p.Dir, p.ImportPath, nil, cfg.BuildToolexec, base.Tool("vet"), VetFlags, a.Objdir+"vet.cfg")
+ tool := VetTool
+ if tool == "" {
+ tool = base.Tool("vet")
+ }
+ return b.run(a, p.Dir, p.ImportPath, nil, cfg.BuildToolexec, tool, VetFlags, a.Objdir+"vet.cfg")
}
// linkActionID computes the action ID for a link action.