@@ -103,6 +103,16 @@ func init() {
103
103
}
104
104
}
105
105
106
+ // There is a copy of findGOROOT, isSameDir, and isGOROOT in
107
+ // x/tools/cmd/godoc/goroot.go.
108
+ // Try to keep them in sync for now.
109
+
110
+ // findGOROOT returns the GOROOT value, using either an explicitly
111
+ // provided environment variable, a GOROOT that contains the current
112
+ // os.Executable value, or else the GOROOT that the binary was built
113
+ // with from runtime.GOROOT().
114
+ //
115
+ // There is a copy of this code in x/tools/cmd/godoc/goroot.go.
106
116
func findGOROOT () string {
107
117
if env := os .Getenv ("GOROOT" ); env != "" {
108
118
return filepath .Clean (env )
@@ -162,6 +172,8 @@ func isSameDir(dir1, dir2 string) bool {
162
172
// It does this by looking for the path/pkg/tool directory,
163
173
// which is necessary for useful operation of the cmd/go tool,
164
174
// and is not typically present in a GOPATH.
175
+ //
176
+ // There is a copy of this code in x/tools/cmd/godoc/goroot.go.
165
177
func isGOROOT (path string ) bool {
166
178
stat , err := os .Stat (filepath .Join (path , "pkg" , "tool" ))
167
179
if err != nil {
0 commit comments