From e7911ad9ea38eaf8707b7247a5ac96bc81de856c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Mar 2017 15:46:03 +0100 Subject: build: unify vendor skipping logic This fixes a recent bug where 'make geth' built everything instead of just geth. --- build/ci.go | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'build/ci.go') diff --git a/build/ci.go b/build/ci.go index 27589fc7f..fcdd33788 100644 --- a/build/ci.go +++ b/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...)) -- cgit v1.2.3 From df1fbe3c067bbca9be10f6fc2d09a66f82313a82 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Mar 2017 15:48:30 +0100 Subject: build: always run go vet This ensures 'make test' finds all errors that remote CI would find. Go 1.7 vet reports a false positive in package log, add a workaround. --- build/ci.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'build/ci.go') diff --git a/build/ci.go b/build/ci.go index fcdd33788..622417580 100644 --- a/build/ci.go +++ b/build/ci.go @@ -24,7 +24,7 @@ Usage: go run ci.go Available commands are: install [ -arch architecture ] [ packages... ] -- builds packages and executables - test [ -coverage ] [ -vet ] [ -misspell ] [ packages... ] -- runs the tests + test [ -coverage ] [ -misspell ] [ packages... ] -- runs the tests archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts importkeys -- imports signing keys from env debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package @@ -262,7 +262,6 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd { func doTest(cmdline []string) { var ( - vet = flag.Bool("vet", false, "Whether to run go vet") misspell = flag.Bool("misspell", false, "Whether to run the spell checker") coverage = flag.Bool("coverage", false, "Whether to record code coverage") ) @@ -275,9 +274,7 @@ func doTest(cmdline []string) { packages = build.ExpandPackagesNoVendor(packages) // Run analysis tools before the tests. - if *vet { - build.MustRun(goTool("vet", packages...)) - } + build.MustRun(goTool("vet", packages...)) if *misspell { spellcheck(packages) } -- cgit v1.2.3