Skip to content
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

x/tools/cmd/godoc: goroot flag has no effect when running in command-line mode #13296

Closed
0xmohit opened this issue Nov 17, 2015 · 2 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@0xmohit
Copy link
Contributor

0xmohit commented Nov 17, 2015

When running in command-line mode, specifying the -goroot flag has no effect. Running:

godoc -goroot=/usr/local/go1.4.2 math/big

would list Float too:

Package big implements multi-precision arithmetic (big numbers). The
following numeric types are supported:

    Int    signed integers
    Rat    rational numbers
    Float  floating-point numbers

If served over HTTP (godoc -goroot=/usr/local/go1.4.2 math/big -http=:6060), the resulting documentation page is as expected.

Setting GOROOT environment variable instead works as expected:

GOROOT=/usr/local/go1.4.2 godoc math/big
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Nov 17, 2015
@agnivade
Copy link
Contributor

agnivade commented Apr 11, 2018

This happens because when a normal package path is passed, the GOROOT is assumed to be build.Default.GOROOT.

If you do - godoc -goroot=/usr/local/go1.4.2 /usr/local/go1.4.2/src/math/big. It gives the correct output. Although it defeats the purpose of passing goroot in the first place.

Will send a fix.

@agnivade agnivade added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 13, 2018
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/110275 mentions this issue: godoc: set the GOROOT path properly in cmdline mode

@golang golang locked and limited conversation to collaborators May 2, 2019
henderjon pushed a commit to oggodoc/godoc that referenced this issue Jun 13, 2024
- Setting the GOROOT build path to the value passed from the command line.

- Clarified the return values to named parameters for extra clarity.

- And while here, added some missed out error handling. Just logging the error
to preserve original behavior.

Fixes golang/go#13296

Change-Id: I91427eee790928a3cfb51ae207747e9a17bd5496
Reviewed-on: https://go-review.googlesource.com/110275
Run-TryBot: Andrew Bonventre <[email protected]>
Reviewed-by: Andrew Bonventre <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants