From: Brad Fitzpatrick Date: Tue, 12 Jun 2018 01:24:00 +0000 (+0000) Subject: cmd/go/internal/cfg: note the copy of this code in x/tools/cmd/godoc X-Git-Tag: go1.11beta1~150 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1352de3829df049f669d5a889832f4e06d4dab5b;p=gostls13.git cmd/go/internal/cfg: note the copy of this code in x/tools/cmd/godoc Updates #23445 Change-Id: I4b09073e53b1cf04de698b711fb5fb0d08bc02df Reviewed-on: https://go-review.googlesource.com/118077 Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go index 3df5905d02..b7906bb1db 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -103,6 +103,16 @@ func init() { } } +// There is a copy of findGOROOT, isSameDir, and isGOROOT in +// x/tools/cmd/godoc/goroot.go. +// Try to keep them in sync for now. + +// findGOROOT returns the GOROOT value, using either an explicitly +// provided environment variable, a GOROOT that contains the current +// os.Executable value, or else the GOROOT that the binary was built +// with from runtime.GOROOT(). +// +// There is a copy of this code in x/tools/cmd/godoc/goroot.go. func findGOROOT() string { if env := os.Getenv("GOROOT"); env != "" { return filepath.Clean(env) @@ -162,6 +172,8 @@ func isSameDir(dir1, dir2 string) bool { // It does this by looking for the path/pkg/tool directory, // which is necessary for useful operation of the cmd/go tool, // and is not typically present in a GOPATH. +// +// There is a copy of this code in x/tools/cmd/godoc/goroot.go. func isGOROOT(path string) bool { stat, err := os.Stat(filepath.Join(path, "pkg", "tool")) if err != nil {