doc/go1.19: document cmd/go changes involving -trimpath

Updates #51461.

Change-Id: Ie878a9f630062d62027de895750a070b50428a9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/399214
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Bryan C. Mills 2022-04-08 16:02:59 -04:00 committed by Bryan Mills
parent f66925e854
commit d85694ab4f

View File

@ -32,7 +32,27 @@ Do not send CLs removing the interior tags from such phrases.
</p> </p>
<h3 id="go-command">Go command</h3> <h3 id="go-command">Go command</h3>
<p> <p>
TODO: complete this section, or delete if not needed TODO: complete this section.
</p>
<!-- https://go.dev/issue/51461 -->
<p>
Passing the <code>-trimpath</code> flag to <code>go</code> commands now
causes <code>runtime.GOROOT()</code> in the resulting binary to return the
empty string instead of the string <code>"go"</code>.
</p>
<p>
The <code>-trimpath</code> flag, if set, is now included in the build settings
stamped into Go binaries by <code>go</code> <code>build</code>, and can be
examined using
<a href="https://pkg.go.dev/cmd/go#hdr-Print_Go_version"><code>go</code> <code>version</code> <code>-m</code></a>
or <a href="https://pkg.go.dev/runtime/debug#ReadBuildInfo"><code>debug.ReadBuildInfo</code></a>.
</p>
<p>
<code>go</code> <code>generate</code> now sets the <code>GOROOT</code>
environment variable explicitly in the generator's environment, so that
generators can locate the correct <code>GOROOT</code> even if built
with <code>-trimpath</code>.
</p> </p>
<h4 id="go-unix">New <code>unix</code> build constraint</h4> <h4 id="go-unix">New <code>unix</code> build constraint</h4>