As of 742dcba go build can accept $CC with spaces and quotes, which lets us easily use zig cc as the C compiler:
CC="zig cc" go build <...>
However, the same does not apply when compiling go itself:
$ CC="zig cc" ./all.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
go tool dist: cannot invoke C compiler "zig cc": exec: "zig cc": executable file not found in $PATH
Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.
This applies to also extra compiler flags, like -v:
CC="clang-13 -v" ./all.bash
Goal: make Go be able to build itself when $CC contains spaces and/or quotes.
As of 742dcba
go buildcan accept$CCwith spaces and quotes, which lets us easily usezig ccas the C compiler:However, the same does not apply when compiling go itself:
This applies to also extra compiler flags, like
-v:Goal: make Go be able to build itself when
$CCcontains spaces and/or quotes.