aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/query.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-09-18 16:14:08 -0400
committerBryan C. Mills <bcmills@google.com>2020-09-22 20:45:27 +0000
commit8f8a8e8921eb46ffba9a5400a259e21eb2011bb7 (patch)
treefc433302f0e6a57802ce332d33553423e611bc72 /src/cmd/go/internal/modload/query.go
parentd140c357442471ca0d56615811fb4226e99fadd5 (diff)
downloadgo-8f8a8e8921eb46ffba9a5400a259e21eb2011bb7.tar.gz
go-8f8a8e8921eb46ffba9a5400a259e21eb2011bb7.zip
cmd/go/internal/modload: eliminate QueryPackage
QueryPackage was a wrapper around QueryPattern with extra validation, called only once from within the same package. Most of that validation was already performed much earlier, in (*loader).Load. Inline the remaining validation and remove the needless indirection. For #36460 Change-Id: I108a01d416197db8f886889554e07b29f0c37f3f Reviewed-on: https://go-review.googlesource.com/c/go/+/256057 Trust: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/query.go')
-rw-r--r--src/cmd/go/internal/modload/query.go14
1 files changed, 0 insertions, 14 deletions
diff --git a/src/cmd/go/internal/modload/query.go b/src/cmd/go/internal/modload/query.go
index 5ddb4e6565..e75d901ec6 100644
--- a/src/cmd/go/internal/modload/query.go
+++ b/src/cmd/go/internal/modload/query.go
@@ -431,20 +431,6 @@ type QueryResult struct {
Packages []string
}
-// QueryPackage looks up the module(s) containing path at a revision matching
-// query. The results are sorted by module path length in descending order.
-//
-// If the package is in the main module, QueryPackage considers only the main
-// module and only the version "latest", without checking for other possible
-// modules.
-func QueryPackage(ctx context.Context, path, query string, allowed AllowedFunc) ([]QueryResult, error) {
- m := search.NewMatch(path)
- if m.IsLocal() || !m.IsLiteral() {
- return nil, fmt.Errorf("pattern %s is not an importable package", path)
- }
- return QueryPattern(ctx, path, query, allowed)
-}
-
// QueryPattern looks up the module(s) containing at least one package matching
// the given pattern at the given version. The results are sorted by module path
// length in descending order.