]> Cypherpunks repositories - gostls13.git/commit
cmd: move GOEXPERIMENT knob from make.bash to cmd/go
authorMatthew Dempsky <mdempsky@google.com>
Thu, 24 Dec 2020 03:49:39 +0000 (19:49 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 11 Mar 2021 21:43:04 +0000 (21:43 +0000)
commit7fc638d6f1679f2e35862555531bf479c3e5b99c
tree70360705cea1ab8adf672605f5ba2f4724b9b6de
parentb3896fc331c36a539f825f1f656cef3f9cdffd3f
cmd: move GOEXPERIMENT knob from make.bash to cmd/go

This CL changes GOEXPERIMENT to act like other GO[CONFIG] environment
variables. Namely, that it can be set at make.bash time to provide a
default value used by the toolchain, but then can be manually set when
running either cmd/go or the individual tools (compiler, assembler,
linker).

For example, it's now possible to test rsc.io/tmp/fieldtrack by simply
running:

GOEXPERIMENT=fieldtrack go test -gcflags=-l rsc.io/tmp/fieldtrack \
  -ldflags=-k=rsc.io/tmp/fieldtrack.tracked

without needing to re-run make.bash. (-gcflags=-l is needed because
the compiler's inlining abilities have improved, so calling a function
with a for loop is no longer sufficient to suppress inlining.)

Fixes #42681.

Change-Id: I2cf8995d5d0d05f6785a2ee1d3b54b2cfb3331ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/300991
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
12 files changed:
src/cmd/asm/internal/lex/input.go
src/cmd/dist/build.go
src/cmd/dist/buildruntime.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/internal/objabi/util.go
src/cmd/link/internal/ld/main.go
src/internal/cfg/cfg.go
src/runtime/heapdump.go
src/runtime/internal/sys/arch.go
src/runtime/proc.go