Skip to content

cmd/compile: clarify whether "-l" and "-N" compiler flags are actually supported #49390

Closed
@bcmills

Description

@bcmills

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.

  1. Declare that the -l and -N flags are fully supported. Remove the test skips based on GO_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 when GO_BUILDER_NAME is not set.)

  2. Declare that the -l and -N flags are fully supported, and also define and document a build tag (such as noopt) that users can set (and check for) to explicitly disable tests that assume optimized builds. Switch the tests to use that build constraint instead of GO_BUILDER_NAME. (The noopt build tag would be conceptually similar to the purego tag discussed in doc: mention "purego" build tag convention somewhere #23172.)

  3. Declare that the -l and -N flags are deprecated but remain available for one-off debugging, and document that in the cmd/compile documentation and a release note. Continue to run the builder, and allow builder-based skips going forward.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions