Skip to content

proposal: go test -c should compile one test binary for all packages listed #65226

Closed
@irl-segfault

Description

@irl-segfault

Proposal Details

go test -c currently produces one test binary per package listed. When running without -c, go test will run all tests for all packages listed. I propose that go test -c mirror that behavior when compiling a test binary, and produce a single a.out that when executed does exactly the same thing as running go test directly without the -c flag.

The reason that I think this is a good idea is because this behavior would reduce the disparity between using the -c and not using it. Concretely, this would make it easier to build and share test executables to run in a single command. I have a concrete use case for this where we run integration tests in a container that's built on build machines. Enabling this would reduce the image size transferred back and forth :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions