-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
The docs say:
GOROOT returns the root of the Go tree. It uses the GOROOT environment variable, if set, or else the root used during the Go build.
Thus I expect this would print "Hi!":
package main
import (
"fmt"
"log"
"os"
"runtime"
)
func main() {
err := os.Setenv("GOROOT", "Hi!")
if err != nil {
log.Fatal(err)
}
fmt.Println(runtime.GOROOT())
}
However, this prints my real goroot, not "Hi!".
Either GOROOT() should actually check the environment variable when called, or the docs should be clarified to specify that it returns the GOROOT environment variable set at init() time.
vpol
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.