github.com/zxy12/go_duplicate_1_12@v0.0.0-20200217043740-b1636fc0368b/src/cmd/dist/cmdbanner.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 "strings" 7 ) 8 9 func banner() { 10 if vflag > 0 { 11 xprintf("\n") 12 } 13 xprintf("---\n") 14 xprintf("Installed Go for %s/%s in %s\n", goos, goarch, goroot) 15 xprintf("Installed commands in %s\n", gobin) 16 17 if !xsamefile(goroot_final, goroot) { 18 // If the files are to be moved, don't check that gobin 19 // is on PATH; assume they know what they are doing. 20 } else if gohostos == "plan9" { 21 // Check that gobin is bound before /bin. 22 pid := strings.Replace(readfile("#c/pid"), " ", "", -1) 23 ns := fmt.Sprintf("/proc/%s/ns", pid) 24 if !strings.Contains(readfile(ns), fmt.Sprintf("bind -b %s /bin", gobin)) { 25 xprintf("*** You need to bind %s before /bin.\n", gobin) 26 } 27 } else { 28 // Check that gobin appears in $PATH. 29 pathsep := ":" 30 if gohostos == "windows" { 31 pathsep = ";" 32 } 33 if !strings.Contains(pathsep+os.Getenv("PATH")+pathsep, pathsep+gobin+pathsep) { 34 xprintf("*** You need to add %s to your PATH.\n", gobin) 35 } 36 } 37 38 if !xsamefile(goroot_final, goroot) { 39 xprintf("\n"+ 40 "The binaries expect %s to be copied or moved to %s\n", 41 goroot, goroot_final) 42 } 43 }