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: list packages in the correct order #15020

Closed
perillo opened this issue Mar 29, 2016 · 7 comments
Closed

x/tools/cmd/godoc: list packages in the correct order #15020

perillo opened this issue Mar 29, 2016 · 7 comments

Comments

@perillo
Copy link
Contributor

perillo commented Mar 29, 2016

https://github.com/golang/go/wiki/CodeReviewComments#imports says that "Imports are organized in groups, with blank lines between them. The standard library packages are in the first group.".

However godoc simply sorts imports in lexicographical order.
This makes it very hard to find the documentation of a standard package.

The order should be:

  1. standard library packages
  2. golang.org/x/ packages
  3. other packages
@ianlancetaylor
Copy link
Contributor

godoc sorts imports within groups.

If you want to maintain groups, use golang.org/x/tools/cmd/goimports.

@perillo
Copy link
Contributor Author

perillo commented Mar 30, 2016

Sorry, but what do you mean with "use golang.org/x/tools/cmd/goimports"?

I'm referring to the package index available at http://localhost:6060/pkg/.

As you can see from https://imagebin.ca/v/2c2N6BhjBUmp, finding documentation for a standard package is quite a pain, since all third party packages are interleaved with standard packages.

@ianlancetaylor
Copy link
Contributor

I'm sorry, I misunderstood your comment. I don't understand your reference to the CodeReviewComments wiki page, as that has nothing to do with what godoc displays.

You are suggesting that godoc should sort the packages it displays differently.

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Mar 31, 2016
@ianlancetaylor
Copy link
Contributor

CC @griesemer

@perillo
Copy link
Contributor Author

perillo commented Apr 6, 2016

I added a reference to CodeReviewComments because Go programmers expect to see packages listed in a well defined order, and this order is not respected by godoc.

However the real problem is that godoc package listing seems to be specialized for https://golang.org/pkg/.
Packages are listed in a section named "Standard library". The problem is that when godoc is executed on a local system, all installed packages are considered part of the standard library.

One possible solution is to add an additional section, that it is only visible when there are third-party packages installed on the system.

@agnivade
Copy link
Contributor

agnivade commented Apr 8, 2018

Duplicate of #3305. My CL does exactly that.

@gopherbot
Copy link

Change https://golang.org/cl/95835 mentions this issue: godoc: group package home page list by root

@golang golang locked and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants