File tree 3 files changed +9
-0
lines changed
doc/next/6-stdlib/99-minor/runtime
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change
1
+ pkg runtime, func GOROOT //deprecated #51473
Original file line number Diff line number Diff line change
1
+ The [ GOROOT] function is now deprecated.
2
+ In new code prefer to use the system path to locate the “go” binary,
3
+ and use ` go env GOROOT ` to find its GOROOT.
Original file line number Diff line number Diff line change @@ -336,6 +336,11 @@ var defaultGOROOT string // set by cmd/link
336
336
// GOROOT returns the root of the Go tree. It uses the
337
337
// GOROOT environment variable, if set at process start,
338
338
// or else the root used during the Go build.
339
+ //
340
+ // Deprecated: The root used during the Go build will not be
341
+ // meaningful if the binary is copied to another machine.
342
+ // Use the system path to locate the “go” binary, and use
343
+ // “go env GOROOT” to find its GOROOT.
339
344
func GOROOT () string {
340
345
s := gogetenv ("GOROOT" )
341
346
if s != "" {
You can’t perform that action at this time.
0 commit comments