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/pkgsite/internal/fetch/dochtml/internal/render: leave a sample of values when trimming large string literals and composite literals #39907

Open
pjebs opened this issue Jun 29, 2020 · 4 comments

Comments

@pjebs
Copy link
Contributor

@pjebs pjebs commented Jun 29, 2020

In godoc.org: https://godoc.org/github.com/rocketlaunchr/google-search (for example),

If you have a map package-level variable with many many predefined values, it doesn't display any of them:

var GoogleDomains = map[string]string{ /* 198 elements not displayed */

}

It would be more useful if displayed some values to give an idea of the kind of values stored:

var GoogleDomains = map[string]string{
	"us":  "https://www.google.com/search?q=",
	"ac":  "https://www.google.ac/search?q=",
	"ad":  "https://www.google.ad/search?q=",
	... /* 195 elements not displayed */
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jul 1, 2020

Thanks for this feature request. I think this is a good idea to consider.

We're currently prioritizing feature development in the new x/pkgsite codebase per https://blog.golang.org/pkg.go.dev-2020 and issues like #37819 and #39144 (/cc @julieqiu). This is likely better suited as an issue for pkg.go.dev. Is that okay with you? (Otherwise, the issue tracker for godoc.org specifically is at https://github.com/golang/gddo/issues.)

@pjebs
Copy link
Contributor Author

@pjebs pjebs commented Jul 1, 2020

Anything's fine

@dmitshur dmitshur added this to the Backlog milestone Jul 1, 2020
@dmitshur dmitshur changed the title godoc: long map variables should give a sample of values. x/pkgsite/internal/fetch/dochtml/internal/render: leave a sample of values when trimming large string literals and composite literals Jul 1, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jul 1, 2020

The relevant code is in declVisitor.

Right now it replaces the entire thing that's too big, leaving just a comment. It can instead leave the first N elements/bytes and trim the rest, as long as it's viable to do so in a way that doesn't create misleading documentation.

It should be balanced with leaving too much that packages start hitting the maximum documentation size limit and not being displayed at all.

/cc @julieqiu @shaqque

@shaqque
Copy link
Contributor

@shaqque shaqque commented Jul 13, 2020

Related #38699

@julieqiu julieqiu modified the milestones: Backlog, pkgsite/dochtml Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants