mirror of
https://github.com/golang/go
synced 2024-11-12 06:30:21 -07:00
cmd/go: check GOROOT directory is present before acting
Fixes #5042. R=golang-dev, adg, rsc CC=golang-dev https://golang.org/cl/7786047
This commit is contained in:
parent
4b2eb3f9f8
commit
d67e300f28
@ -144,6 +144,11 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
if fi, err := os.Stat(goroot); err != nil || !fi.IsDir() {
|
||||
fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", goroot)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
for _, cmd := range commands {
|
||||
if cmd.Name() == args[0] && cmd.Run != nil {
|
||||
cmd.Flag.Usage = func() { cmd.Usage() }
|
||||
|
Loading…
Reference in New Issue
Block a user