mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
build, internal/build: sort out vendor quircks
This commit is contained in:
parent
d4336f00a6
commit
0ed91a7557
2 changed files with 16 additions and 11 deletions
16
build/ci.go
16
build/ci.go
|
|
@ -178,6 +178,7 @@ func goTool(subcmd string, args ...string) *exec.Cmd {
|
|||
cmd := exec.Command(gocmd, subcmd)
|
||||
cmd.Args = append(cmd.Args, args...)
|
||||
cmd.Env = []string{
|
||||
"GO15VENDOREXPERIMENT=1",
|
||||
"GOPATH=" + build.GOPATH(),
|
||||
"GOBIN=" + GOBIN,
|
||||
}
|
||||
|
|
@ -200,11 +201,24 @@ func doTest(cmdline []string) {
|
|||
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
|
||||
)
|
||||
flag.CommandLine.Parse(cmdline)
|
||||
|
||||
packages := []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))
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run analysis tools before the tests.
|
||||
if *vet {
|
||||
build.MustRun(goTool("vet", packages...))
|
||||
|
|
|
|||
|
|
@ -55,16 +55,7 @@ func GOPATH() string {
|
|||
if len(path) == 0 {
|
||||
log.Fatal("GOPATH is not set")
|
||||
}
|
||||
// Ensure Godeps workspace is present in the path.
|
||||
godeps, _ := filepath.Abs(filepath.Join("Godeps", "_workspace"))
|
||||
for _, dir := range path {
|
||||
if dir == godeps {
|
||||
return strings.Join(path, string(filepath.ListSeparator))
|
||||
}
|
||||
}
|
||||
newpath := append(path[:1], godeps)
|
||||
newpath = append(newpath, path[1:]...)
|
||||
return strings.Join(newpath, string(filepath.ListSeparator))
|
||||
return strings.Join(path, string(filepath.ListSeparator))
|
||||
}
|
||||
|
||||
// VERSION returns the content of the VERSION file.
|
||||
|
|
|
|||
Loading…
Reference in a new issue