]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/cfg: note the copy of this code in x/tools/cmd/godoc
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 12 Jun 2018 01:24:00 +0000 (01:24 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 12 Jun 2018 01:39:57 +0000 (01:39 +0000)
Updates #23445

Change-Id: I4b09073e53b1cf04de698b711fb5fb0d08bc02df
Reviewed-on: https://go-review.googlesource.com/118077
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/internal/cfg/cfg.go

index 3df5905d02691b9d69cb4e0e19a5b9a7f490c8ff..b7906bb1dbb32e874e2bc5bebee9b56021b999d8 100644 (file)
@@ -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 {