# Extension points — golang/go

> Canonical page: https://codevetter.com/unpack/go/extension-points

# Extension points — golang/go

Scanned commit 12c76d447f576e6c14c566c8524c13a0c0d476b9 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Extension is table-driven almost everywhere: new 'go' subcommands register in main.go's command table; new architectures add an Init func to cmd/compile's archInits map plus an ssagen.ArchInfo; new SSA passes go in the ordered passes table; new VCS tools extend vcsList; experiments are file-pairs in internal/goexperiment; GODEBUGs register in internal/godebugs/table.go; new stdlib API must add lines to api/next and release notes under doc/next; new test/ cases just drop files into the enumerated dirs.
- New 'go' subcommands: create a package under cmd/go/internal/<name>, define a &base.Command{Run, UsageLine, Flag, ...}, and append it to base.Go.Commands in cmd/go/main.go init(). — [src/cmd/go/main.go#L50-92](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/main.go#L50-L92) [src/cmd/go/internal/base/base.go#L28-54](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/internal/base/base.go#L28-L54)
- Nested subcommand groups work via Command.Commands (e.g. 'go mod', 'go work'); Lookup ignores non-runnable entries so help topics coexist in the same table. — [src/cmd/go/internal/base/base.go#L50-74](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/internal/base/base.go#L50-L74) [src/cmd/go/internal/modcmd/mod.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/internal/modcmd/mod.go)
- New CPU architecture: add an entry to archInits in cmd/compile/main.go mapping GOARCH name to an Init(*ssagen.ArchInfo), implement the arch package under cmd/compile/internal/<arch>, and add a linker backend dir under cmd/link/internal/<arch>. — [src/cmd/compile/main.go#L28-43](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/compile/main.go#L28-L43) [src/cmd/compile/internal/ssagen/arch.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/compile/internal/ssagen/arch.go) [src/cmd/link/internal/amd64](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/link/internal/amd64)
- New SSA optimization pass: append to the `passes` table in ssacompile/compile.go (line ~414); ordering is verified ('passes %s and %s out of order') and each pass gets timing/debug plumbing automatically. — [src/cmd/compile/internal/ssacompile/compile.go#L413-480](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/compile/internal/ssacompile/compile.go#L413-L480) [src/cmd/compile/internal/ssacompile/compile.go#L574-607](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/compile/internal/ssacompile/compile.go#L574-L607)
- New VCS support: add a *Cmd to vcsList in vcs.go with Name/Cmd/Env/Roots/Scheme/PingCmd/Status; secure schemes come from defaultSecureScheme. — [src/cmd/go/internal/vcs/vcs.go#L35-125](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/internal/vcs/vcs.go#L35-L125)
- New toolchain experiment: add exp_<name>_on.go/exp_<name>_off.go file pairs in src/internal/goexperiment (existing pairs: arenas, boringcrypto, cgocheck2, dwarf5, fieldtrack, ...); buildcfg surfaces them via GOEXPERIMENT. — [src/internal/goexperiment](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/internal/goexperiment) [src/internal/buildcfg/cfg.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/internal/buildcfg/cfg.go)
- New GODEBUG compatibility setting: register in internal/godebugs/table.go, document in doc/godebug.md; runtime reads values and fatals on removed ones. — [src/internal/godebugs/table.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/internal/godebugs/table.go) [doc/godebug.md](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/doc/godebug.md) [src/runtime/proc.go#L220-225](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/runtime/proc.go#L220-L225)
- New stdlib API: implementation in src/<pkg>, one line in api/next/*.txt with proposal issue annotation, release-note entry under doc/next/6-stdlib; the api test enforces the manifest. — [api/README](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/api/README) [api/next](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/api/next) [doc/next/1-intro.md](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/doc/next/1-intro.md) [src/cmd/api/api_test.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/api/api_test.go)
- New regression test: drop a .go file with a '// run'/'// errorcheck' comment into test/ or test/fixedbugs; it is picked up automatically by testdir without registration. — [src/cmd/internal/testdir/testdir_test.go#L72-120](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/internal/testdir/testdir_test.go#L72-L120) [test/README.md](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/test/README.md) [test/fixedbugs/bug000.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/test/fixedbugs/bug000.go)
- New cmd/go script test: add a txtar script under src/cmd/go/testdata/script; the cmd/internal/script engine interprets commands/conditions without code changes. — [src/cmd/go/testdata/script](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/testdata/script) [src/cmd/internal/script/engine.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/internal/script/engine.go)
- New telemetry counter: call counter.New("name") / counter.Inc in cmd or compiler code; CountFlags auto-instruments flag usage per subcommand. — [src/cmd/go/main.go#L96-114](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/main.go#L96-L114) [src/cmd/internal/telemetry/counter](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/internal/telemetry/counter)
- Build-time microarch targeting is env-extensible: GOAMD64/GOARM64/GORISCV64 etc. parsed in buildcfg; adding a level means extending the envOr validators, not the tools. — [src/internal/buildcfg/cfg.go#L22-120](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/internal/buildcfg/cfg.go#L22-L120)
- Vet analysis passes plug in through golang.org/x/tools/go/analysis (imported by work/exec.go), so new analyzers come from the x/tools module rather than this repo. — [src/cmd/go/internal/work/exec.go#L51](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/go/internal/work/exec.go#L51) [src/cmd/vet/main.go](https://github.com/golang/go/blob/12c76d447f576e6c14c566c8524c13a0c0d476b9/src/cmd/vet/main.go)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
