aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/load/pkg.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-11-21 15:32:52 -0500
committerGopher Robot <gobot@golang.org>2023-05-18 19:33:59 +0000
commitebfd80ba6f231f80484d5fedca5b60e1f166644e (patch)
tree1840be88c7c33381be57539fc373aad0669b20e8 /src/cmd/go/internal/load/pkg.go
parent72f448cb48069ddeb0c30e726fc3b9d113aaf51e (diff)
downloadgo-ebfd80ba6f231f80484d5fedca5b60e1f166644e.tar.gz
go-ebfd80ba6f231f80484d5fedca5b60e1f166644e.zip
cmd/go: propagate Context arguments through modfetch methods
For #56886. For #38714. Change-Id: I15c4a8673407d3423d7e203d645c6d0fb780d192 Reviewed-on: https://go-review.googlesource.com/c/go/+/452456 Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r--src/cmd/go/internal/load/pkg.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 1d5c074fdc..7878619a35 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -2024,7 +2024,7 @@ func (p *Package) load(ctx context.Context, opts PackageOpts, path string, stk *
// Consider starting this as a background goroutine and retrieving the result
// asynchronously when we're actually ready to build the package, or when we
// actually need to evaluate whether the package's metadata is stale.
- p.setBuildInfo(opts.AutoVCS)
+ p.setBuildInfo(ctx, opts.AutoVCS)
}
// If cgo is not enabled, ignore cgo supporting sources
@@ -2267,7 +2267,7 @@ var vcsStatusCache par.ErrCache[string, vcs.Status]
//
// Note that the GoVersion field is not set here to avoid encoding it twice.
// It is stored separately in the binary, mostly for historical reasons.
-func (p *Package) setBuildInfo(autoVCS bool) {
+func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) {
setPkgErrorf := func(format string, args ...any) {
if p.Error == nil {
p.Error = &PackageError{Err: fmt.Errorf(format, args...)}
@@ -2288,7 +2288,7 @@ func (p *Package) setBuildInfo(autoVCS bool) {
if mi.Replace != nil {
dm.Replace = debugModFromModinfo(mi.Replace)
} else if mi.Version != "" {
- dm.Sum = modfetch.Sum(module.Version{Path: mi.Path, Version: mi.Version})
+ dm.Sum = modfetch.Sum(ctx, module.Version{Path: mi.Path, Version: mi.Version})
}
return dm
}
@@ -3280,7 +3280,7 @@ func PackagesAndErrorsOutsideModule(ctx context.Context, opts PackageOpts, args
return nil, fmt.Errorf("%s: %w", args[0], err)
}
rootMod := qrs[0].Mod
- data, err := modfetch.GoMod(rootMod.Path, rootMod.Version)
+ data, err := modfetch.GoMod(ctx, rootMod.Path, rootMod.Version)
if err != nil {
return nil, fmt.Errorf("%s: %w", args[0], err)
}