Commit d94da6fa authored by Anthony Martin's avatar Anthony Martin Committed by Ron Minnich

cmd/dist: instruct the user to bind $GOBIN on Plan 9

R=seed, rminnich, bradfitz, r
CC=golang-dev
https://golang.org/cl/7395059
parent cb4428e5
...@@ -1588,7 +1588,7 @@ cmdclean(int argc, char **argv) ...@@ -1588,7 +1588,7 @@ cmdclean(int argc, char **argv)
void void
cmdbanner(int argc, char **argv) cmdbanner(int argc, char **argv)
{ {
char *pathsep; char *pathsep, *pid, *ns;
Buf b, b1, search, path; Buf b, b1, search, path;
ARGBEGIN{ ARGBEGIN{
...@@ -1612,15 +1612,28 @@ cmdbanner(int argc, char **argv) ...@@ -1612,15 +1612,28 @@ cmdbanner(int argc, char **argv)
xprintf("Installed Go for %s/%s in %s\n", goos, goarch, goroot); xprintf("Installed Go for %s/%s in %s\n", goos, goarch, goroot);
xprintf("Installed commands in %s\n", gobin); xprintf("Installed commands in %s\n", gobin);
// Check that gobin appears in $PATH. if(streq(gohostos, "plan9")) {
xgetenv(&b, "PATH"); // Check that gobin is bound before /bin.
pathsep = ":"; readfile(&b, "#c/pid");
if(streq(gohostos, "windows")) bsubst(&b, " ", "");
pathsep = ";"; pid = btake(&b);
bprintf(&b1, "%s%s%s", pathsep, bstr(&b), pathsep); bprintf(&b, "/proc/%s/ns", pid);
bprintf(&search, "%s%s%s", pathsep, gobin, pathsep); ns = btake(&b);
if(xstrstr(bstr(&b1), bstr(&search)) == nil) readfile(&b, ns);
xprintf("*** You need to add %s to your PATH.\n", gobin); bprintf(&search, "bind -b %s /bin\n", gobin);
if(xstrstr(bstr(&b), bstr(&search)) == nil)
xprintf("*** You need to bind %s before /bin.\n", gobin);
} else {
// Check that gobin appears in $PATH.
xgetenv(&b, "PATH");
pathsep = ":";
if(streq(gohostos, "windows"))
pathsep = ";";
bprintf(&b1, "%s%s%s", pathsep, bstr(&b), pathsep);
bprintf(&search, "%s%s%s", pathsep, gobin, pathsep);
if(xstrstr(bstr(&b1), bstr(&search)) == nil)
xprintf("*** You need to add %s to your PATH.\n", gobin);
}
if(streq(gohostos, "darwin")) { if(streq(gohostos, "darwin")) {
if(isfile(bpathf(&path, "%s/cov", tooldir))) if(isfile(bpathf(&path, "%s/cov", tooldir)))
......
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