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: some functions are not being indexed for search #8932

Open
gopherbot opened this issue Oct 14, 2014 · 3 comments
Open

x/tools/cmd/godoc: some functions are not being indexed for search #8932

gopherbot opened this issue Oct 14, 2014 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gopherbot
Copy link
Contributor

by bgarcia@golang.org:

What steps will reproduce the problem?
  In a running godoc instance, search for ParseDuration

What is the expected output?
  There should be a "Functions" heading at the top, with time.ParseDuration as a result within it.  Clicking that link should take you to the documentation for time.ParseDuration.

What do you see instead?
  There is no link to the time.ParseDuration documentation.
  Depending on the options that godoc was run with, you will see results with source code links under "Package-level declarations" and "Local declarations and uses".

---
There are two factors that cause this condition to occur.
First, the function in question returns a type defined in the same package.  Second, the
type being returned is defined in a different file from the function.

In the example above, time.ParseDuration is defined in time/format.go, while the
time.Duration type that it returns is defined in time/time.go.

---
When godoc parses files to index the documentation, it currently parses each file
individually.  When time/format.go is parsed, godoc does not have the definition of
time.Duration.  Because of this, time.ParseDuration is then thrown away when we attempt
to treat its like the methods on a type (which we do for functions which look like
constructors).

One solution would be to index the documentation on a package level instead of a file
level.
@gopherbot
Copy link
Contributor Author

Comment 1:

CL https://golang.org/cl/160820045 mentions this issue.

@gopherbot gopherbot added the new label Oct 14, 2014
@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

Suggestion seems to be to list time.ParseDuration in the Function table of contents even though it's not in the functions section in the doc (but instead listed under type Duration as a constructor).

@rsc rsc changed the title godoc: some functions are not being indexed for search cmd/godoc: some functions are not being indexed for search Apr 10, 2015
@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015
@rsc
Copy link
Contributor

rsc commented Jul 14, 2015

Too late for Go 1.5.

@rsc rsc modified the milestones: Unplanned, Go1.5Maybe Jul 14, 2015
@agnivade agnivade changed the title cmd/godoc: some functions are not being indexed for search x/tools/cmd/godoc: some functions are not being indexed for search Apr 29, 2018
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants