Repository navigation
Description
Context
go tool nsgo check -target all vets 15 targets one after another (goAndXcodeTargets, cmd/nsgo/build.go:316 on main at 7ec1e19), and in NSGo's own repository each target is vetted twice (./..., then ./internal/platform/... with nsgotest, cmd/nsgo/check.go:104-108). With the host vet and the two dev client vets that check runs first (check.go:36-56), one run is about 33 go vet passes, and since every GOOS/GOARCH has its own build cache entries most of them compile cold.
Because that is slow, contributors and coding agents split it into several processes (nsgo check -target web, nsgo check -target android_arm64, nsgo check -target linux_x64, … at once). Two things then go wrong:
- Every
nsgo check -target Xfirst runs the host vet and, in the repository, both dev client vets (check.go:36-56) beforecheckTargets. Five processes run those three passes five times. - Nothing bounds the parallelism. Each
go vetcompiles with GOMAXPROCS workers, and twocheckprocesses in the same module do not know about each other.
Observed on a 12-core Apple M4 Pro: five concurrent nsgo check runs in the repository (-target all, web, android_arm64, linux_x64 and one more) put about 30 compile processes on the machine at once, CPU idle at 0% and the 1-minute load average at 440–500; the per-process CPU deltas showed the duplicated host go vet ./... under each -target X run.
Why it matters
AGENTS.md asks every change to be checked with go tool nsgo check (line 53), and the contributing guide offers only check and check -target all (docs/public/en/contributing.md:36-37). The tool gives no supported way to make the full check faster, so the natural workaround — more processes — repeats work and saturates the machine for everything else on it (other builds, simulators, the IDE).
Proposal
- When
-targetis given, let the host and dev client vets be skipped, either by default for an explicit target list or behind a flag such as-targets-only, sonsgo check -target webvets onlyweb. - Add a parallelism flag (for example
-jobs N) thatcheckpasses togo vetas-p Nand uses to vet up to a bounded number of targets at once inside one process. One process with a bound is then the fast path, not several unbounded ones. - Take a lock per module (for example under
.nsgo/) for the duration ofcheck: a secondcheckin the same module prints that another one (pid) is running and waits, rather than competing with it. - Say in
docs/public/en/contributing.md(andAGENTS.md) how to check locally: vet the platform you changed with-target <name>, give several targets to one process (-target a,b,c) rather than starting several, and leave the full matrix tocheck.yml, which already splits it between Linux and macOS.
Acceptance
-
nsgo check -target web(with the chosen flag, if it is not the default) runs no host or dev client vet. -
nsgo check -target all -jobs 4never runs more than 4 compile workers pergo vetnor more than the given number of targets at once, and finishes faster than today's sequential run on a multi-core machine. - A second
nsgo checkstarted in the same module while one runs waits for it and says so. - The contributing guide describes the local check strategy above.
- Platforms: all (the
nsgocommand) - NSGo: main at 7ec1e19 (2026-11-18)
- Development machine: macOS 27.2 (Apple M4 Pro, 12 cores), Go 1.27.3
Activity