]> Cypherpunks.ru repositories - gostls13.git/commit
internal/goexperiment,cmd: consolidate GOEXPERIMENTs into a new package
authorAustin Clements <austin@google.com>
Tue, 6 Apr 2021 12:25:01 +0000 (08:25 -0400)
committerAustin Clements <austin@google.com>
Thu, 8 Apr 2021 02:17:16 +0000 (02:17 +0000)
commit6304b401e4bcfc1d61dd687bb5b7df13fd71033b
tree7f9e87d47b4a1baf3809f12e18bcc1d5a1248e9f
parent0c4a08cb74abe026260a224a2b553c1f77a1172a
internal/goexperiment,cmd: consolidate GOEXPERIMENTs into a new package

Currently there's knowledge about the list of GOEXPERIMENTs in a few
different places. This CL introduces a new package and consolidates
the list into one place: the internal/goexperiment.Flags struct type.

This package gives us a central place to document the experiments as
well as the GOEXPERIMENT environment variable itself. It will also
give us a place to put built-time constants derived from the enabled
experiments.

Now the objabi package constructs experiment names by reflecting over
this struct type rather than having a separate list of these names
(this is similar to how the compiler handles command-line flags and
debug options). We also expose a better-typed API to the toolchain for
propagating enabled experiments.

Change-Id: I06e026712b59fe2bd7cd11a869aedb48ffe5a4b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/307817
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/asm/internal/lex/input.go
src/cmd/dist/buildtool.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/init.go
src/cmd/internal/objabi/exp.go [new file with mode: 0644]
src/cmd/internal/objabi/util.go
src/internal/goexperiment/flags.go [new file with mode: 0644]