aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/list.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-17 19:52:21 +0000
commitc0cf190d226cc3defb71d17c01d0b45bf49a8a85 (patch)
treec0a77e4d51c22dec30af472f7de473212773fa13 /src/cmd/go/internal/modload/list.go
parent797124f5ff4bb80957007adbf3115287a4e90870 (diff)
downloadgo-c0cf190d226cc3defb71d17c01d0b45bf49a8a85.tar.gz
go-c0cf190d226cc3defb71d17c01d0b45bf49a8a85.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: I5bf2d599aafef67334c384dfccd5e255198c85b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/248327 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/list.go')
-rw-r--r--src/cmd/go/internal/modload/list.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go
index 8db4d64706..7bf4e86c8d 100644
--- a/src/cmd/go/internal/modload/list.go
+++ b/src/cmd/go/internal/modload/list.go
@@ -31,7 +31,7 @@ func ListModules(ctx context.Context, args []string, listU, listVersions bool) [
sem <- token{}
go func() {
if listU {
- addUpdate(m)
+ addUpdate(ctx, m)
}
if listVersions {
addVersions(m)
@@ -57,7 +57,7 @@ func ListModules(ctx context.Context, args []string, listU, listVersions bool) [
func listModules(ctx context.Context, args []string, listVersions bool) []*modinfo.ModulePublic {
LoadBuildList(ctx)
if len(args) == 0 {
- return []*modinfo.ModulePublic{moduleInfo(buildList[0], true)}
+ return []*modinfo.ModulePublic{moduleInfo(ctx, buildList[0], true)}
}
var mods []*modinfo.ModulePublic
@@ -83,7 +83,7 @@ func listModules(ctx context.Context, args []string, listVersions bool) []*modin
}
}
- info, err := Query(path, vers, current, nil)
+ info, err := Query(ctx, path, vers, current, nil)
if err != nil {
mods = append(mods, &modinfo.ModulePublic{
Path: path,
@@ -92,7 +92,7 @@ func listModules(ctx context.Context, args []string, listVersions bool) []*modin
})
continue
}
- mods = append(mods, moduleInfo(module.Version{Path: path, Version: info.Version}, false))
+ mods = append(mods, moduleInfo(ctx, module.Version{Path: path, Version: info.Version}, false))
continue
}
@@ -117,7 +117,7 @@ func listModules(ctx context.Context, args []string, listVersions bool) []*modin
matched = true
if !matchedBuildList[i] {
matchedBuildList[i] = true
- mods = append(mods, moduleInfo(m, true))
+ mods = append(mods, moduleInfo(ctx, m, true))
}
}
}
@@ -127,9 +127,9 @@ func listModules(ctx context.Context, args []string, listVersions bool) []*modin
// Don't make the user provide an explicit '@latest' when they're
// explicitly asking what the available versions are.
// Instead, resolve the module, even if it isn't an existing dependency.
- info, err := Query(arg, "latest", "", nil)
+ info, err := Query(ctx, arg, "latest", "", nil)
if err == nil {
- mods = append(mods, moduleInfo(module.Version{Path: arg, Version: info.Version}, false))
+ mods = append(mods, moduleInfo(ctx, module.Version{Path: arg, Version: info.Version}, false))
} else {
mods = append(mods, &modinfo.ModulePublic{
Path: arg,