I am trying to reconcile why make.bash accepts GOARCH, GOOS and other target variables when it also supports cross compiling to all supported architectures by default. I am compiling this for amd64/linux but will be using the compiler to cross-compile apps for arm/linux in an embedded context. Buildroot builds Go with the following command
cd /builddir/build/host-go-1.10.2/src &&
GOROOT_BOOTSTRAP=/builddir/host/lib/go-1.4.3
GOROOT_FINAL=/builddir/host/lib/go
GOROOT="/builddir/build/host-go-1.10.2"
GOBIN="/builddir/build/host-go-1.10.2/bin"
GOARCH=arm
GOARM=7
GOOS=linux
CC=/usr/bin/gcc
CXX=/usr/bin/g++
GO_ASSUME_CROSSCOMPILING=1
CC_FOR_TARGET="/builddir/host/bin/arm-linux-gnueabihf-gcc"
CXX_FOR_TARGET="/builddir/host/bin/arm-linux-gnueabihf-g++"
CGO_ENABLED=1
./make.bash
Which works and goes on to build other apps just fine. My question is why are these target variables relevant at this stage? Wouldn't that only be relevant to the applications being compiled with this program?