char *goroot = GOROOT_FINAL;
char *goroot_final = GOROOT_FINAL;
char *workdir;
-char *tooldir;
+char *tooldir;
char *gochar;
char *goversion;
char *slash; // / for unix, \ for windows
cmdbanner(int argc, char **argv)
{
char *pathsep;
- Buf b, b1, search;
+ Buf b, b1, search, path;
ARGBEGIN{
case 'v':
binit(&b);
binit(&b1);
binit(&search);
+ binit(&path);
xprintf("\n");
xprintf("---\n");
xprintf("*** You need to add %s to your PATH.\n", gobin);
if(streq(gohostos, "darwin")) {
- xprintf("\n"
- "On OS X the debuggers must be installed setgid procmod.\n"
- "Read and run ./sudo.bash to install the debuggers.\n");
+ if(isfile(bpathf(&path, "%s/cov", tooldir)))
+ xprintf("\n"
+ "On OS X the debuggers must be installed setgid procmod.\n"
+ "Read and run ./sudo.bash to install the debuggers.\n");
}
if(!streq(goroot_final, goroot)) {
bfree(&b);
bfree(&b1);
bfree(&search);
+ bfree(&path);
}
// Version prints the Go version.
exit 0
esac
+eval $(go env)
+if ! [ -x $GOTOOLDIR/cov -a -x $GOTOOLDIR/prof ]; then
+ echo "You don't need to run sudo.bash." >&2
+ exit 2
+fi
+
if [[ ! -d /usr/local/bin ]]; then
echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.'
exit 2
fi
-eval $(go env)
cd $(dirname $0)
for i in prof cov
do