#!/bin/sh # mesh-check-toolchain: go # # The Go part of the SDK's own check (novox/hq ADR 0237 as amended, ADR 0272): the Go binding, run by the build # seat in the mesh's Go toolchain, its own container, because the SDK's merge-check.sh declares it # (`# mesh-check-also: go go/merge-check.sh`) — and by hand, from anywhere: `sh go/merge-check.sh`. # # Formatted, vetted (with and without the build tag `integration`), and run at two levels (novox/hq ADR 0391): # # 1. the unit level: `go test ./...` untagged, no bus or other process, timed and held to a bound # (unit_bound below); over it the check fails and names the slowest tests (issue 895); # 2. the integration level: the whole suite with `-tags integration`, each test against a bus of its # own (internal/testbus, which issue 1171 brings with the first test that needs a bus) so nothing is # serialised. With no tagged test yet, the level runs the unit tests again and says their count. # # **A test that starts a bus or another process carries `//go:build integration`** as the first line of # its file; a file that held both kinds is two files (`_integration_test.go` beside `_test.go`). # Each level says its test count and its time. # # No dependency is committed (no vendor directory: .gitignore; the operator, 2026-10-19; issue 1304). Every dependency # is resolved by the version and checksum go.sum names (novox/hq ADR 0405 §5), from its public source: this binding # requires nothing of the mesh's own forge. `go mod verify` fails by module name when a downloaded dependency does not # match go.sum, and -mod=readonly fails a build whose go.sum lacks an entry instead of writing it. gofmt reads only # the binding's own files. # # Exit 0 is a pass; anything else fails `mesh/repo-check` with the last line printed. set -eu cd "$(dirname "$0")" # The toolchain the check runs in sets -mod=vendor; there is no vendor directory, so it is replaced. GOFLAGS="$(printf '%s' "${GOFLAGS:-}" | sed 's/-mod=[a-z]*//g') -mod=readonly" export GOFLAGS export GOPRIVATE=git.novox.be # **The unit level's bound, in seconds** (issue 895): the slowest package's own test time of the untagged run, # the compile not counted. A run over it fails the check and names the slowest tests. The SDK's unit suite is # small (its slowest package measured well under a second on a quiet machine), so 2 s leaves room for a busier # build node without hiding a test that should carry `integration` instead. unit_bound=2 # judge_unit_run says the unit level as `go test -v` reported it and fails when it was over the bound: $1 the # file holding the output of the untagged `go test -v` of every package (packages one after another, each # ending in its `ok