diff options
author | Cherry Mui <cherryyz@google.com> | 2023-02-28 18:43:14 -0500 |
---|---|---|
committer | Cherry Mui <cherryyz@google.com> | 2023-03-06 19:22:18 +0000 |
commit | 74502e9bb4d732239fa684969ddb22e7b7345f3a (patch) | |
tree | ffe22011a8c9340cf35b446de5954219d3cd72c7 /src/cmd/go/alldocs.go | |
parent | 5987f3c2715d93cb52f05dcb1c29825507e1d625 (diff) | |
download | go-74502e9bb4d732239fa684969ddb22e7b7345f3a.tar.gz go-74502e9bb4d732239fa684969ddb22e7b7345f3a.zip |
cmd/go: support multiple main packages with -pgo=auto
In -pgo=auto mode, the go command finds a profile named
default.pgo in the main package's directly, and if found, use it
as the profile for the build. Currently we only support a single
main package when -pgo=auto is used.
When multiple main packages are included in a build, they may
have different default profiles (or some have profiles whereas
some don't), so a common dependent package would need to be built
multiple times, with different profiles (or lack of). This CL
handles this. To do so, we need to split (unshare) the dependency
graph so they can attach different profiles.
Fixes #58099.
Change-Id: I1ad21361967aafbf5089d8d5e89229f95fe31276
Reviewed-on: https://go-review.googlesource.com/c/go/+/472358
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/alldocs.go')
-rw-r--r-- | src/cmd/go/alldocs.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index fe17709016..523540869a 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -202,8 +202,10 @@ // run through go run and go test respectively. // -pgo file // specify the file path of a profile for profile-guided optimization (PGO). -// Special name "auto" lets the go command select a file named -// "default.pgo" in the main package's directory if that file exists. +// When the special name "auto" is specified, for each main package in the +// build, the go command selects a file named "default.pgo" in the package's +// directory if that file exists, and applies it to the (transitive) +// dependencies of the main package (other packages are not affected). // Special name "off" turns off PGO. // -pkgdir dir // install and load all packages from dir instead of the usual locations. |