Documentation
¶
Overview ¶
Package testbin builds a Go executable for tests that need one with build information in it. The test binary itself is not a reliable stand-in: before Go 1.27 the go command generated a test binary's build information before wiring up the test main's imports, so the module list in it came out empty (cmd/go/internal/load/test.go regenerates it after the imports since 1.27). A decomposer reading such a binary finds no dependencies.
Index ¶
Constants ¶
const Package = "github.com/carabiner-dev/unpack/internal/testbin/fixture"
Package is the import path of the fixture program.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build returns the path of the fixture executable and the build information it carries, compiling it the first time a test of the package asks for it. Every test gets the same executable, so tests must treat it as read-only: copy it to change it.
The build runs with VCS stamping off, so the main module is always (devel) and the result does not depend on the state of the checkout. It is not trimmed (-trimpath) so it reuses the packages the go command already compiled for the test binary instead of compiling them again. The executable lives in a directory of its own in the system temporary directory, which outlives the tests that share it and is not removed.
Types ¶
This section is empty.