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

Comments

Projects
None yet
4 participants
@perillo
Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2016

godoc sorts imports within groups.

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

@perillo

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2016

@perillo

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

commented Apr 8, 2018

Duplicate of #3305. My CL does exactly that.

@gopherbot

This comment has been minimized.

Copy link

commented Apr 8, 2018

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.
You can’t perform that action at this time.