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

cmd/doc: go doc os.ModTime does not print enough #31961

Closed
rsc opened this issue May 10, 2019 · 4 comments
Closed

cmd/doc: go doc os.ModTime does not print enough #31961

rsc opened this issue May 10, 2019 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented May 10, 2019

$ go doc os.ModTime
func ModTime() time.Time // modification time
$

I am fairly sure there is no top-level ModTime function in os.

@rsc rsc added this to the Go1.13 milestone May 10, 2019
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 10, 2019
@ianlancetaylor
Copy link
Contributor

go doc has acted like this since 1.8. This is clearly a bug but I'm not sure it's a release blocker.

@agnivade
Copy link
Contributor

I think some clarification is needed here

The comment for symbolDoc says

// symbolDoc prints the docs for symbol. There may be multiple matches.
// If symbol matches a type, output includes its methods factories and associated constants.
// If there is no top-level symbol, symbolDoc looks for methods that match.

And then printMethodDoc first searches for a struct type's methods, and then goes to an interface type's methods. Which is what we see here.

So just to clarify- go doc os.Sync gives

func (f *File) Sync() error
    Sync commits the current contents of the file to stable storage. Typically,
    this means flushing the file system's in-memory copy of recently written
    data to disk.

which is correct, but go doc os.ModTime is not ?

Should the correct behavior be only to check struct's methods if there is no top-level symbol, or to not check any method at all (in which case, it is even a bigger behavior change) ?

cc @robpike

@agnivade agnivade added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 21, 2019
@ianlancetaylor
Copy link
Contributor

go doc os.ModTime prints

func ModTime() time.Time  // modification time

That is clearly wrong, as there is no such function in the os package.

The output of go doc os.Sync correctly reports that Sync is a method of File.

@agnivade agnivade added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels May 22, 2019
@gopherbot
Copy link

Change https://golang.org/cl/178457 mentions this issue: cmd/doc: stop showing interface methods while matching symbols

@golang golang locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants