diff options
author | Michael Matloob <matloob@golang.org> | 2020-06-30 17:51:52 -0400 |
---|---|---|
committer | Michael Matloob <matloob@golang.org> | 2020-08-17 19:52:21 +0000 |
commit | c0cf190d226cc3defb71d17c01d0b45bf49a8a85 (patch) | |
tree | c0a77e4d51c22dec30af472f7de473212773fa13 /src/cmd/go/internal/modload/mvs.go | |
parent | 797124f5ff4bb80957007adbf3115287a4e90870 (diff) | |
download | go-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/mvs.go')
-rw-r--r-- | src/cmd/go/internal/modload/mvs.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/mvs.go b/src/cmd/go/internal/modload/mvs.go index 5dd009d31d..67eb2c2e19 100644 --- a/src/cmd/go/internal/modload/mvs.go +++ b/src/cmd/go/internal/modload/mvs.go @@ -5,6 +5,7 @@ package modload import ( + "context" "errors" "fmt" "os" @@ -224,7 +225,7 @@ func (*mvsReqs) next(m module.Version) (module.Version, error) { // // The isLocal return value reports whether the replacement, // if any, is local to the filesystem. -func fetch(mod module.Version) (dir string, isLocal bool, err error) { +func fetch(ctx context.Context, mod module.Version) (dir string, isLocal bool, err error) { if mod == Target { return ModRoot(), true, nil } @@ -254,6 +255,6 @@ func fetch(mod module.Version) (dir string, isLocal bool, err error) { mod = r } - dir, err = modfetch.Download(mod) + dir, err = modfetch.Download(ctx, mod) return dir, false, err } |