Description
Update Dec 15 2021 The answer appears to be:
I think that building with -l -N is fully supported. I don't think that running standard library tests when building with -l -N is fully supported.
-@rsc
I've seen a number of changes lately where test failures on the linux-amd64-noopt
builder are worked around by skipping tests based on the presence of -noopt
in the GO_BUILDER_NAME
environment variable:
https://cs.opensource.google/search?q=%22-noopt%22%20case:yes&ss=go%2Fgo
Looking at the git history, it appears that all of these environment-based skips were added within the past year. (As far as I can tell, this is a recent shift, not a long-standing practice.)
Those tests are for packages within std
, and thus may be run as part of go test all
within a user's module. Users are not expected to set GO_BUILDER_NAME
, but may reasonably set any supported compiler flag in the GOFLAGS
environment variable. go test all
should be a reasonable thing for users to do, and should pass reliably for any supported build configuration.
That leads to the central question of this issue: are the -l
and -N
flags still a supported way for Go users to build their programs?
To me, the existence of the linux-amd64-noopt
builder suggests that they are. However, if they are supported, then the tests in std
should also pass in that supported configuration when run by users, and today they systematically do not.
I propose that we take one of the following courses of action. I don't have a strong preference as to which one.
-
Declare that the
-l
and-N
flags are fully supported. Remove the test skips based onGO_BUILDER_NAME
containing-noopt
, and fix the tests throughout the project so that they pass by default when the-l
and/or-N
flags are set. (Perhaps convert the tests to benchmarks, and/or skip them whenGO_BUILDER_NAME
is not set.) -
Declare that the
-l
and-N
flags are fully supported, and also define and document a build tag (such asnoopt
) that users can set (and check for) to explicitly disable tests that assume optimized builds. Switch the tests to use that build constraint instead ofGO_BUILDER_NAME
. (Thenoopt
build tag would be conceptually similar to thepurego
tag discussed in doc: mention "purego" build tag convention somewhere #23172.) -
Declare that the
-l
and-N
flags are deprecated but remain available for one-off debugging, and document that in thecmd/compile
documentation and a release note. Continue to run the builder, and allow builder-based skips going forward.