build: unify vendor skipping logic
This fixes a recent bug where 'make geth' built everything instead of just geth.
This commit is contained in:
29
build/ci.go
29
build/ci.go
@ -173,19 +173,7 @@ func doInstall(cmdline []string) {
|
||||
if flag.NArg() > 0 {
|
||||
packages = flag.Args()
|
||||
}
|
||||
|
||||
// Resolve ./... manually and remove vendor/bazil/fuse (fuse is not in windows)
|
||||
out, err := goTool("list", "./...").CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatalf("package listing failed: %v\n%s", err, string(out))
|
||||
}
|
||||
packages = []string{}
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if !strings.Contains(line, "vendor") {
|
||||
packages = append(packages, strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
|
||||
packages = build.ExpandPackagesNoVendor(packages)
|
||||
|
||||
if *arch == "" || *arch == runtime.GOARCH {
|
||||
goinstall := goTool("install", buildFlags(env)...)
|
||||
@ -284,19 +272,8 @@ func doTest(cmdline []string) {
|
||||
if len(flag.CommandLine.Args()) > 0 {
|
||||
packages = flag.CommandLine.Args()
|
||||
}
|
||||
if len(packages) == 1 && packages[0] == "./..." {
|
||||
// Resolve ./... manually since go vet will fail on vendored stuff
|
||||
out, err := goTool("list", "./...").CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatalf("package listing failed: %v\n%s", err, string(out))
|
||||
}
|
||||
packages = []string{}
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if !strings.Contains(line, "vendor") {
|
||||
packages = append(packages, strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
}
|
||||
packages = build.ExpandPackagesNoVendor(packages)
|
||||
|
||||
// Run analysis tools before the tests.
|
||||
if *vet {
|
||||
build.MustRun(goTool("vet", packages...))
|
||||
|
Reference in New Issue
Block a user