Backport os.Expand from Go v1.10.8
This is needed because Go v1.11+ changed the behavior in
https://github.com/golang/go/commit/7bf631e1fc55839a6bff404a91597326e1addc10#diff-b30ffd1cf7612ccebac97fced83d5106
so that $
isn't gobbled unless the value is a valid shell variable
(e.g. $FOOBAR
, ${FOOBAR}
).
Since this may break CI builds that rely on this legacy behavior, keep it for now.
Edited by Stan Hu