aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/search.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2020-06-30 17:51:52 -0400
committerMichael Matloob <matloob@golang.org>2020-08-20 15:21:17 +0000
commit3f568625980f6e23a603cfd1cb4fcd2bf5c895d7 (patch)
tree8b7e298f273a45bf6ced7e2135ba28ebb68823f3 /src/cmd/go/internal/modload/search.go
parentc57c0212ebf44b7896477177c8e35be79ff3a586 (diff)
downloadgo-3f568625980f6e23a603cfd1cb4fcd2bf5c895d7.tar.gz
go-3f568625980f6e23a603cfd1cb4fcd2bf5c895d7.zip
cmd/go: do context propagation for tracing downloads
This change does context propagation (and only context propagation) necessary to add context to modfetch.Download and pkg.LoadImport. This was done by adding context to their callers, and then adding context to all call-sites, and then repeating adding context to callers of those enclosing functions and their callers until none were left. In some cases the call graph expansion was pruned by using context.TODOs. The next CL will add a span to Download. I kept it out of this change to avoid making it any larger (and harder to review) than it needs to be. Updates #38714 Change-Id: I7a03416e04a14ca71636d96f2c1bda2c4c30d348 Reviewed-on: https://go-review.googlesource.com/c/go/+/249021 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/search.go')
-rw-r--r--src/cmd/go/internal/modload/search.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/search.go b/src/cmd/go/internal/modload/search.go
index c28e7c0c1e..a9bee0af4e 100644
--- a/src/cmd/go/internal/modload/search.go
+++ b/src/cmd/go/internal/modload/search.go
@@ -5,6 +5,7 @@
package modload
import (
+ "context"
"fmt"
"os"
"path/filepath"
@@ -27,7 +28,7 @@ const (
// matchPackages is like m.MatchPackages, but uses a local variable (rather than
// a global) for tags, can include or exclude packages in the standard library,
// and is restricted to the given list of modules.
-func matchPackages(m *search.Match, tags map[string]bool, filter stdFilter, modules []module.Version) {
+func matchPackages(ctx context.Context, m *search.Match, tags map[string]bool, filter stdFilter, modules []module.Version) {
m.Pkgs = []string{}
isMatch := func(string) bool { return true }
@@ -153,7 +154,7 @@ func matchPackages(m *search.Match, tags map[string]bool, filter stdFilter, modu
isLocal = true
} else {
var err error
- root, isLocal, err = fetch(mod)
+ root, isLocal, err = fetch(ctx, mod)
if err != nil {
m.AddError(err)
continue