diff options
author | Michael Matloob <matloob@golang.org> | 2020-06-17 15:50:14 -0400 |
---|---|---|
committer | Michael Matloob <matloob@golang.org> | 2020-08-12 18:35:45 +0000 |
commit | 2bfa45cfa994512c47da2d98f3baca5bb474ec9b (patch) | |
tree | 778bf0b657ea89fd96c28c467f2f2e1d0054b7b8 /src/cmd/go/internal/run/run.go | |
parent | 14715b24793176b30b3c41adf4ac4e676c2a56f0 (diff) | |
download | go-2bfa45cfa994512c47da2d98f3baca5bb474ec9b.tar.gz go-2bfa45cfa994512c47da2d98f3baca5bb474ec9b.zip |
cmd/go: propagate context into PackagesForBuild and Do for tracing
This change propagates context into PackagesForErrors and Do for
the purpose of tracing, and calls trace.StartSpan on PackagesForErrors
and Do, so that the trace now shows the broad outline of where
the "Loading" and "Execution" phases are in the build.
Updates #38714
Change-Id: Ib9a7cf7030210f68f76663d1c8a7461e0a226611
Reviewed-on: https://go-review.googlesource.com/c/go/+/238541
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/run/run.go')
-rw-r--r-- | src/cmd/go/internal/run/run.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go index ca2c3db92c..3630f68c54 100644 --- a/src/cmd/go/internal/run/run.go +++ b/src/cmd/go/internal/run/run.go @@ -79,7 +79,7 @@ func runRun(ctx context.Context, cmd *base.Command, args []string) { } p = load.GoFilesPackage(files) } else if len(args) > 0 && !strings.HasPrefix(args[0], "-") { - pkgs := load.PackagesAndErrors(args[:1]) + pkgs := load.PackagesAndErrors(ctx, args[:1]) if len(pkgs) == 0 { base.Fatalf("go run: no packages loaded from %s", args[0]) } @@ -141,7 +141,7 @@ func runRun(ctx context.Context, cmd *base.Command, args []string) { } a1 := b.LinkAction(work.ModeBuild, work.ModeBuild, p) a := &work.Action{Mode: "go run", Func: buildRunProgram, Args: cmdArgs, Deps: []*work.Action{a1}} - b.Do(a) + b.Do(ctx, a) } // buildRunProgram is the action for running a binary that has already |