#!/bin/sh # mesh-check-toolchain: go # # The controller's own check (novox/hq ADR 0237 as amended): the second layer of a pull request's merge # check, `mesh/repo-check`, run by the build seat in the mesh's Go toolchain — and by hand: # `MESH_TEST_POSTGRES=… sh merge-check.sh`. # # The gate — every machine composed with this change's controller, which judges itself — is the build # seat's first layer (`mesh/merge-gate`), run because the mesh's module graph builds `mesh-controller` # from this repository; it is not repeated here. This is the code's own quality and its suite: # # 1. formatted and vetted; # 2. the whole suite, packages in parallel, against the throwaway store the build seat raised at the # release the mesh runs; every live test on a bus of its own (internal/testbus), so nothing is # serialised. Under the race detector when the toolchain has a C compiler, and said when it has not. # # Exit 0 is a pass; anything else fails `mesh/repo-check` with the last line printed. set -eu export GOFLAGS=-mod=vendor GOPROXY=off unformatted=$(gofmt -l cmd internal examples) if [ -n "$unformatted" ]; then echo "not gofmt'd:" echo "$unformatted" exit 1 fi CGO_ENABLED=0 go vet ./... if command -v gcc >/dev/null 2>&1; then CGO_ENABLED=1 go test -race -count=1 -timeout 30m ./... else echo "NOT RACE-CHECKED: the toolchain holds no C compiler; the suite runs without the race detector" CGO_ENABLED=0 go test -count=1 -timeout 30m ./... fi