golang/go
The repo is the entire Go distribution: src/ holds the standard library (module 'std'), the runtime, and all toolchain commands under src/cmd/ (module 'cmd'). The build is bootstrapped: src/make.bash compiles src/cmd/dist with a pre-existing Go (GOROOT_BOOTSTRAP), then 'dist bootstrap' builds the compiler/linker/asm and a go_bootstrap binary which rebuilds the full tree. The go command (src/cmd/go) is the user-facing front end dispatching to ~20 subcommands; compilation flows through cmd/compile (frontend+SSA backend) and cmd/link. Tests are orchestrated by 'go tool dist test' (src/cmd/dist/test.go) plus the cmd/internal/testdir harness for the test/ corpus. API stability is enforced by golden manifests in api/ checked by src/cmd/api tests.
- The repo is the Go toolchain itself: src/ contains the stdlib (module 'std', go 1.28) with vendored deps golang.org/x/crypto, x/net, x/sys, x/text; cmd/ is a separate module 'cmd' with its own vendor tree.
- Building from source runs src/make.bash from $GOROOT/src, which locates GOROOT_BOOTSTRAP (a Go tree >= 1.26.0, bootgo=1.26.0), builds ./cmd/dist with it, then executes './cmd/dist/dist bootstrap -a'.
- cmd/dist's cmdbootstrap() pins GOPATH to $GOROOT/pkg/obj/gopath, sets GOPROXY=off and GOCACHE=$GOROOT/pkg/obj/go-build, forces GOEXPERIMENT=none for toolchain1, then calls bootstrapBuildTools() to build cmd/asm, cmd/cgo, cmd/compile, cmd/link, cmd/preprofile and go_bootstrap.
- make.bash refuses to run on Windows (use make.bat), rejects gold linker 2.20, warns about SELinux execstack policy, and forbids GOROOT_BOOTSTRAP == GOROOT.
- The go command entrypoint src/cmd/go/main.go registers all subcommands into base.Go.Commands in init(), then in main() runs telemetry setup, handleChdirFlag, toolchain.Select, flag parsing, lookupCmd, and invoke(cmd, args).
- base.Command is the universal command abstraction: fields Run, UsageLine, Short, Long, Flag, CustomFlags, Commands; Runnable() is Run != nil; help topics are non-runnable Commands.
- The compiler binary cmd/compile/main.go selects a per-architecture initializer from the archInits map (386, amd64, arm, arm64, loong64, mips*, ppc64*, riscv64, s390x, wasm) keyed on buildcfg.GOARCH, then calls gc.Main(archInit).
- The linker cmd/link/internal/ld parses a large flag surface (-o, -buildid, -race/-msan/-asan, -linkmode via extld, -checklinkname, -randlayout, -k field tracking) and supports internal linking or delegation to an external linker.
- The runtime scheduler in src/runtime/proc.go implements the G/M/P model (goroutines, OS threads, processors) with distributed per-P run queues, a global run queue, spinning-thread protocol (m.spinning, sched.nmspinning) and work stealing in findRunnable.
- The GC in src/runtime/mgc.go is a concurrent, non-generational, non-compacting mark-and-sweep with a hybrid write barrier, per-P size-segregated allocation, and a GC rate governed by GOGC (default 100).
- Build configuration is centralized in internal/buildcfg: GOARCH/GOOS plus micro-arch levels GOAMD64/GOARM64/GORISCV64 etc., GO_LDSO, GOFIPS140, and buildcfg.Check() exits tools on invalid values.
- go.env at repo root seeds defaults GOPROXY=https://proxy.golang.org,direct, GOSUMDB=sum.golang.org, GOTOOLCHAIN=auto — the checksum DB and auto toolchain download are on by default.
- Test execution is orchestrated by cmd/dist's 'dist test' subcommand (tester struct with race/msan/asan/compile-only modes, -run regexp, JSON output), invoked by run.bash as '../bin/go tool dist test -rebuild'.
- api/ contains frozen per-release API manifests (go1.txt..go1.27.txt, except.txt) plus a mutable api/next; src/cmd/api tests walk the stdlib API and compare against these files to enforce Go 1 compatibility.