CodeVetter · Repo Unpack · Testing signals
golang/go
Testing is massive and layered: package-level Go tests throughout stdlib and cmd, the ~1900-file test/ black-box corpus driven by cmd/internal/testdir with //-directive comments, cmd/go's script-based tests under testdata/script using the cmd/internal/script engine, dist-level orchestration with race/msan/asan/compile-only modes, and API golden tests. CI is not GitHub Actions — .github contains only templates; testing runs on Go's own builder fleet via all.bash/run.bash with sharding support.
- testdir_test.go runs every test/*.go file as a subtest 'Test/<path>' over dirs {., ken, chan, interface, internal/runtime/sys, syntax, dwarf, fixedbugs, codegen, abi, typeparam, arenas, simd}; directives like '// run' and '// errorcheck' in each file control execution; flags -shard/-shards/-target/-update_errors/-all_codegen exist.
- run.bash exports GOENV=off, GOPATH=/nonexist-gopath, disables core dumps, then execs 'go tool dist test -rebuild'; GO_TEST_SHARDS (default 1, or 10 on builders), GO_BUILDER_NAME, GO_TEST_SHORT, GO_TEST_TIMEOUT_SCALE control behavior.
- cmd/dist/test.go's tester supports -race, -msan, -asan, -compile-only, -k (keep going), -run regexp (invertible with '!'), -json output; tests are grouped under headings and run as parallel work items.
- cmd/go has extensive tests: go_test.go, plus script-driven tests in src/cmd/go/testdata/script executed by the cmd/internal/script engine (engine.go, conds.go, cmds_*.go).
- API compatibility is tested by src/cmd/api: api_test.go TestGolden/TestCompareAPI walks exported symbols and diffs against api/go1*.txt + api/next; boring_test.go covers FIPS API differences.
- The compiler backend is heavily unit-tested in-tree: ssacompile has ~30 *_test.go files (prove_test, fuse_test, rewriteCond_test, looprotate_test, regalloc_test, schedule_test, etc.); test/codegen files assert generated-assembly patterns.
- cmd/go/internal/verylongtest exists as a separate package for tests too slow for normal runs; run.bash's GO_TEST_SHORT plumbing distinguishes short vs long builders.
- internal/testenv provides test helpers (GoToolPath, Builder) used by testdir and other cmd tests to locate the freshly built toolchain and detect builder environment.
- buildall.bash/race.bash/clean.bash in src/ provide cross-compile and race-mode build verification; all.bash chains make.bash + run.bash + 'dist banner'.
- There are no GitHub Actions workflows: .github/ contains only CODE_OF_CONDUCT, ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE, SUPPORT; review runs on Gerrit (codereview.cfg) with LUCI builders — CI config is external to the repo (x/build). (inferred)
- VCS behavior is tested hermetically: cmd/go/internal/vcweb.Server hosts fake repos (VCSTestRepoURL/VCSTestHosts/VCSTestIsLocalHost hooks in vcs.go) so tests don't hit the network.
- Test flag definitions are shared and generated: genflags.go emits flagdefs.go so 'go test' flags and vet/test2json stay consistent; flagdefs_test.go verifies.