Go bindings
A program with gopkg bindings needs a Go toolchain, unless every binding is a first-party lib/ module’s (the SQLite and Postgres drivers, sqlkit, markdown, image, the password hashers) and the nomi is a release. Pure-Nomi programs and tests need none.
- A release carries the
lib/modules’ Go side prebuilt, at the commit it was cut at:nomi-lib, whichnomi run,nomi testandnomi checkrun such a program in, andnomi-vm-lib, whichnomi buildappends it to, for each native platform andjs/wasm. They ship in a lib archive per platform beside the main one, whichnomidownloads from its release the first time it needs it unless it is unpacked besidenomi, and they must come from the same commit asnomi.nomi addtakes alib/module at that commit, andnomi updatemoves everylib/module to it. A project that also has a binding of its own, or alib/module at another commit, builds a wrapper with Go as below; with no Go, the error names the binding or the version, and for a version, thatnomi updatealigns it.wasip1/wasmhas no prebuiltlib/runner, since modernc.org/sqlite does not build for it. nomi run,nomi checkandnomi testcompile the bound packages, with Nomi’s own Go module, into a wrapper they cache under the user cache directory (nomi/builds/, safe to delete). The first run of a project is slower; later runs reuse the wrapper until the project’s Go code, itsgo.modornomichanges, and editing.nomifiles never rebuilds it. A released orgo installednomicompiles against Nomi’s module at its own version, which Go fetches; one built from a clone compiles against the clone (Installing Nomi).- With no
goonPATH,nomidownloads the Go release it was built with and uses that (The Go toolchain). - A bound package may be in a module from the Go module cache, a dependency’s included.
- Go bindings build with
CGO_ENABLED=0, so agopkgnaming a package that needs cgo, itself or through a package it imports, is a check error at the path:gopkg "example.com/app/wrap": needs cgo: it imports example.com/cdriver/internal/csql (...), whose files import "C", and Go bindings build with CGO_ENABLED=0.
The Go toolchain
Section titled “The Go toolchain”A module’s Go code (the gopkg bindings of spec §19), in the project or in a dependency, is built into the program’s runner with a Go toolchain: the go on PATH; or, with none, the Go release nomi was built with, which nomi downloads once from go.dev, checks against a SHA-256 compiled into nomi, and keeps in its cache (<user cache>/nomi/go/). NOMI_GO names a go (or a Go root) to use instead of both. The language server uses that toolchain only once it is downloaded.