Commit 6d4da06d authored by Shenghou Ma's avatar Shenghou Ma

cmd/dist, cmd/go: move CGO_ENABLED from 'go tool dist env' to 'go env'

        So that we don't duplicate knowledge about which OS/ARCH combination
        supports cgo.
        Also updated src/run.bash and src/sudo.bash to use 'go env'.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5792055
parent 1e374502
......@@ -52,19 +52,6 @@ static char *okgoos[] = {
"windows",
};
// The known cgo-enabled combinations.
// This list is also known to ../../pkg/go/build/build.go.
static char *okcgo[] = {
"darwin/386",
"darwin/amd64",
"linux/386",
"linux/amd64",
"freebsd/386",
"freebsd/amd64",
"windows/386",
"windows/amd64",
};
static void rmworkdir(void);
// find reports the first index of p in l[0:n], or else -1.
......@@ -1321,11 +1308,6 @@ cmdenv(int argc, char **argv)
xprintf(format, "GOTOOLDIR", tooldir);
xprintf(format, "GOCHAR", gochar);
if(find(bprintf(&b, "%s/%s", goos, goarch), okcgo, nelem(okcgo)) >= 0)
xprintf(format, "CGO_ENABLED", "1");
else
xprintf(format, "CGO_ENABLED", "0");
if(pflag) {
sep = ":";
if(streq(gohostos, "windows"))
......
......@@ -45,6 +45,12 @@ func mkEnv() []envVar {
{"GOGCCFLAGS", strings.Join(b.gccCmd(".")[3:], " ")},
}
if buildContext.CgoEnabled {
env = append(env, envVar{"CGO_ENABLED", "1"})
} else {
env = append(env, envVar{"CGO_ENABLED", "0"})
}
return env
}
......
......@@ -5,7 +5,7 @@
set -e
eval $(go tool dist env)
eval $(go env)
unset CDPATH # in case user has it set
......
......@@ -17,7 +17,7 @@ if [[ ! -d /usr/local/bin ]]; then
exit 2
fi
eval $(go tool dist env)
eval $(go env)
cd $(dirname $0)
for i in prof cov
do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment