Skip to content
Snippets Groups Projects
Commit a5d61d75 authored by Dmitri Shuralyov's avatar Dmitri Shuralyov Committed by Gopher Robot
Browse files

runtime: deprecate GOROOT

Fixes #51473.

Change-Id: Ic868790f480b21b472c98b39be797bcffb1fa892
Reviewed-on: https://go-review.googlesource.com/c/go/+/564142


Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
Reviewed-by: default avatarDmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
parent 830621bc
No related branches found
No related tags found
No related merge requests found
pkg runtime, func GOROOT //deprecated #51473
The [GOROOT] function is now deprecated.
In new code prefer to use the system path to locate the “go” binary,
and use `go env GOROOT` to find its GOROOT.
...@@ -336,6 +336,11 @@ var defaultGOROOT string // set by cmd/link ...@@ -336,6 +336,11 @@ var defaultGOROOT string // set by cmd/link
// GOROOT returns the root of the Go tree. It uses the // GOROOT returns the root of the Go tree. It uses the
// GOROOT environment variable, if set at process start, // GOROOT environment variable, if set at process start,
// or else the root used during the Go build. // or else the root used during the Go build.
//
// Deprecated: The root used during the Go build will not be
// meaningful if the binary is copied to another machine.
// Use the system path to locate the “go” binary, and use
// “go env GOROOT” to find its GOROOT.
func GOROOT() string { func GOROOT() string {
s := gogetenv("GOROOT") s := gogetenv("GOROOT")
if s != "" { if s != "" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment