Summary
build.sh uses two GNU-coreutils-only commands:
BUILD_DATE="$(date --utc)" # GNU date; BSD/macOS date wants `-u`
BUILD_ARCH="$(arch)" # GNU coreutils; on macOS, `arch` returns "i386" even on Apple Silicon
On macOS:
date --utc errors out with usage: date [-jnRu]…. Without set -e already in place, this errors at build time; with set -e (current state), the script aborts.
arch exists but reports the kernel arch (i386 for 64-bit, arm64 on M1+). On macOS the canonical Go-style arch comes from uname -m.
This makes build.sh Linux-only despite Go being portable.
Impact (Cross-platform: Low)
Suggested Fix
Replace with portable equivalents:
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" # POSIX date -u, ISO 8601
BUILD_OS="$(go env GOOS)"
BUILD_ARCH="$(go env GOARCH)"
go env is always available since this is a Go project, and it returns the same canonical values Go uses internally (linux/darwin/windows × amd64/arm64/…).
Bonus: drop OSTYPE (a bash-only variable) in favor of go env GOOS.
Files
Summary
build.shuses two GNU-coreutils-only commands:On macOS:
date --utcerrors out withusage: date [-jnRu]…. Withoutset -ealready in place, this errors at build time; withset -e(current state), the script aborts.archexists but reports the kernel arch (i386for 64-bit,arm64on M1+). On macOS the canonical Go-style arch comes fromuname -m.This makes
build.shLinux-only despite Go being portable.Impact (Cross-platform: Low)
./build.shlocally; must invokego builddirectly.OSTYPEvalue differs between bash on macOS and Linux).Suggested Fix
Replace with portable equivalents:
go envis always available since this is a Go project, and it returns the same canonical values Go uses internally (linux/darwin/windows × amd64/arm64/…).Bonus: drop
OSTYPE(a bash-only variable) in favor ofgo env GOOS.Files
build.sh:11-12, 25-26