aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/test/test.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-03-15 13:41:48 -0400
committerJay Conrod <jayconrod@google.com>2019-04-01 13:50:27 +0000
commitd6b2b35e641eeac9f764d21dcaed46973b3e2720 (patch)
tree49c05f207d4db79fe4a8540616436fe1399d5341 /src/cmd/go/internal/test/test.go
parent4091cf972a37418c847426bd15709cd0128fad81 (diff)
downloadgo-d6b2b35e641eeac9f764d21dcaed46973b3e2720.tar.gz
go-d6b2b35e641eeac9f764d21dcaed46973b3e2720.zip
cmd/go: refactor load.LoadPackage into other functions
LoadPackage was used to load a *load.Package for a command line argument, after pattern expansion. It provided two special cases on top of LoadImport. First, it ensured that "cmd/" packages in GOROOT were installed in "$GOROOT/bin" or "$GOROOT/pkg/tool". Second, it translated absolute paths to packages in GOROOT and GOPATH into regular import paths. With this change, LoadImport now ensures "cmd/" packages have the right Target (without the need for a special case) and search.ImportPaths translates absolute paths. LoadPackage no longer handles these special cases and has been renamed to LoadImportWithFlags, since it's still useful for loading implicit dependencies. Updates #29758 Change-Id: I9d54036f90c3ccd9b3a0fe0eaddaa7749593cc91 Reviewed-on: https://go-review.googlesource.com/c/go/+/167748 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/test/test.go')
-rw-r--r--src/cmd/go/internal/test/test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index b43925d5e5..225dab31de 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -760,7 +760,7 @@ func ensureImport(p *load.Package, pkg string) {
}
}
- p1 := load.LoadPackage(pkg, &load.ImportStack{})
+ p1 := load.LoadImportWithFlags(pkg, p.Dir, p, &load.ImportStack{}, nil, 0)
if p1.Error != nil {
base.Fatalf("load %s: %v", pkg, p1.Error)
}