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/godoc: user-provided PageInfoMode flags are cleared when viewing docs for fake package "builtin" #30300

Closed
dmitshur opened this issue Feb 18, 2019 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

As documented at https://godoc.org/golang.org/x/tools/cmd/godoc:

The presentation mode of web pages served by godoc can be controlled with the "m" URL parameter;

This works for most packages, e.g., https://golang.org/pkg/path/?m=src shows the original source code rather than the extracted documentation.

It does not work for the fake package builtin: https://golang.org/pkg/builtin/?m=src has no effect.

This is because that package needs a few of the presentation modes to be applied at all times, but this is done in a way that clears the user-provided modes:

mode := h.p.GetPageInfoMode(r)
if relpath == builtinPkgPath {
	// the fake built-in package contains unexported identifiers
	mode = NoFiltering | NoTypeAssoc
}

The fix is one character:

-mode = NoFiltering | NoTypeAssoc
+mode |= NoFiltering | NoTypeAssoc
@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 18, 2019
@dmitshur dmitshur added this to the Unreleased milestone Feb 18, 2019
@dmitshur dmitshur self-assigned this Feb 18, 2019
@gopherbot
Copy link

Change https://golang.org/cl/162983 mentions this issue: godoc: don't clear user-set page mode for package builtin

@golang golang locked and limited conversation to collaborators Feb 19, 2020
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

2 participants