-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: GOROOT() docs are confusing #22302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@gopherbot added the Documentation label automatically due to "docs" in issue title, but I think it needs to be decided/confirmed whether it's a bug in implementation or documentation. If the current behavior is deemed correct, here's a take at fixing the documentation:
Also, https://godoc.org/runtime#NumCPU has some precedent:
|
Oh well, I tried. |
Decision: document current behavior. runtime.GOROOT is already too subtle without changing this detail. |
In that case, it'll be a good idea to add a test for this behavior (if one doesn't already exist). |
Change https://golang.org/cl/75751 mentions this issue: |
The docs say:
Thus I expect this would print "Hi!":
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.
The text was updated successfully, but these errors were encountered: