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: don't group functions under types, except constructors and methods #40927

jayconrod opened this issue Aug 20, 2020 · 3 comments


Copy link

@jayconrod jayconrod commented Aug 20, 2020

What is the URL of the page with the issue?


What is your user agent?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36


Screen Shot 2020-08-10 at 11 30 08 AM

What did you do?

Look for documentation on net/http.Get, or really any exported function that returns a type defined in the same package.

What did you expect to see?

Get should be grouped under Functions on the left sidebar, together with other functions like Handle and Serve.

In general, I'd expect to see all exported functions grouped there, except for methods and constructors. I'd define a constructor as a function named New or NewX where X is the name of a type defined in the package, returning a value or a pointer of that type and maybe an error.

What did you see instead?

Get is grouped together with the Response type. It has the signature:

func Get(url string) (resp *Response, err error)

I think it's grouped with Response because it returns *Response. Maybe it's considered a constructor?

This isn't new behavior in Both and have this behavior, too. The new left sidebar is much more prominent than the index was on those sites, so this issue is more of a problem now.

Copy link

@salewski salewski commented Aug 20, 2020

Possible dup of #38666, #28006, and related to #39813 and #27928, which discuss the go/doc heuristic for identifying "factory functions" (best explained by this comment).

@dmitshur dmitshur added the pkgsite label Aug 20, 2020
Copy link

@dmitshur dmitshur commented Aug 20, 2020

Copy link

@julieqiu julieqiu commented Aug 20, 2020

Let's close this in favor of using #39813 as the tracking issue for considering changes to the "factory function" behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants