Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions internal/guard/buildtags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ func compilesOurCode(line string) bool {
// the build FAILS. A guard reading internal/format/avif for a build constraint
// would stay green against a file that had stopped failing.
func TestABuildWithoutTheBuildTagsRefusesAndSaysWhy(t *testing.T) {
// Asked before building, and this one cannot use the "an error means skip"
// shape the other ten callers of the toolchain use, because here an error
// is the ANSWER. A missing compiler and a compiler that refused both arrive
// as err != nil, so without this the test reads "the build failed, which is
// right" about a machine that never ran a build, and then reports that the
// message does not name build tags - with the message empty.
//
// Measured on 2026-09-06: that is exactly what it did in the container
// tools/linux-check.py uses, which has no Go in it by design. It was the
// only test of the suite to fail there, and it blamed the refusal rather
// than the environment. Same idiom and same reason as
// TestABuildWithNoWindowInItSaysSoAndKeepsStandardOutputEmpty.
if _, err := exec.LookPath("go"); err != nil {
t.Skipf("no Go toolchain here, so no build can be refused: %v", err)
}

out := filepath.Join(t.TempDir(), "untagged.bin")
cmd := exec.Command("go", "build", "-o", out, "./cmd/tfg")
cmd.Dir = filepath.Join("..", "..")
Expand Down
Loading