SIGN IN SIGN UP

cmd/api: include baseline goexperiment.* tool tags

There are some exported package APIs that have started out as being
gated behind a GOEXPERIMENT, requiring users to explicitly opt in,
and have since become enabled for all users. This was done by having
their experiment enabled as a baseline, even when GOEXPERIMENT is left
as the empty string.

It's necessary to populate the go/build.Context.ToolTags field for
those APIs to be found by the API check. We can't directly use
build.Context.Default since that only has the ToolTags for the current
platform, so compute ToolTags from buildcfg, the same source that the
go/build package populates the default build context from.
A difference is that the API check always passes the empty GOEXPERIMENT
string to ParseGOEXPERIMENT, ignoring any potential GOEXPERIMENT set in
the environment.

For #79733.
Fixes #79737.

Change-Id: I2c4502c4f5416b4ce0466d6dd6dd030b6fdcf1ca
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/784980
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
D
Dmitri Shuralyov committed
5d2a112176e9fb295eab0b672863de0a9c7c1485
Parent: 783a68b
Committed by Gopher Robot <gobot@golang.org> on 5/29/2026, 7:41:08 PM