$ hive build main.hive
Compiled main.hive -> main (1s)
$ hive build main.hive --target linux/arm64
Compiled main.hive -> main-linux-arm64 (2s)
$ hive build main.hive --target=windows/amd64
Compiled main.hive -> main-windows-amd64.exe (2s)$ hive build main.hive --target linux/sparc
hive: `--target linux/sparc` is not a platform the Go toolchain builds for. A target is a `goos/goarch` pair — `linux/arm64`, `darwin/arm64`, `windows/amd64` — and `go tool dist list` names every one it knows.
$ hive build main.hive --target
hive: `--target` was given no platform to build for. It takes a `goos/goarch` pair — `hive build <entrypoint.hive> --target linux/arm64`.
$ hive check main.hive --target linux/arm64
hive: `--target` is a flag of `hive build` and `hive export`. `check` builds nothing for another platform.The last step of a build is the Go toolchain, so a Hive program is built for another platform the way any Go program is: by telling the toolchain which one. hive build takes a --target, a goos/goarch pair, and the pair is checked before anything is compiled. go tool dist list names every platform the toolchain knows, and one it does not name is refused there and then, as a mistake in what was typed — not ten seconds later, by a build failing in a language you did not write. The list is asked for rather than kept, so a platform Go learns tomorrow needs no change here.
main.hive is main, and a cross build is main-linux-arm64, so a cross build never quietly replaces the local one. The .exe follows the target rather than the machine: --target windows/amd64 writes main-windows-amd64.exe from anywhere.CGO_ENABLED=0, and a build for this machine is given no environment at all — byte for byte the build it always was.build and export take it, the two commands that write something for a platform. check, emit, test and container refuse the flag rather than quietly ignoring it. Under hive run, everything after the entrypoint belongs to the program, so a --target written there is passed straight through to it.