In 2012 Russ wisely and definitively addressed portability of make.bash:

We are aware of the history of incompatibilities between shells.

For a while we did try to write portable shell scripts, but that

was distracting us from the real work of writing Go

[https://github.com/golang/go/issues/3235#issuecomment-66064352]

For those who care, Korn shell suffices for compiling from source. A Go 
bootstrap from somewhere you trust and a default OpenBSD install is enough 
without any other dependencies. This is of interest for those of us 
scrutinizing software supply chain security these days. Here's the trick:

ed make.bash

/build -o

s/.*/(&)

wq

ksh make.bash

If you're curious, what's happening is that

foo() {

"$@"

}

export R=r

R=s foo date

echo $R

prints "r" in bash but "s" in ksh.  Adding the parens in make.bash runs the 
dist build in a subshell and does the right thing for setting GOROOT under 
both shells.

It would be nice to upstream that two-character change so we can match tree 
hashes, but only if it is clearly understood that the team is not making 
any promise of future support for anything other than bash. Even with my 
change, ksh still prints a warning about "-a" being an unknown arg to the 
"type" builtin, though fortunately that doesn't affect my use case. I have 
done no testing of other Go tools when bash is missing.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7568aa17-268d-4e01-8a27-f6ef60eb2065n%40googlegroups.com.

Reply via email to