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/godoc: does not print comments accompanying variable literals #29775

Open
stapelberg opened this issue Jan 16, 2019 · 4 comments
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stapelberg
Copy link
Contributor

Take the following example code:

package exported

var IPs = []string{
"127.0.0.1", // localhost

// IPv6 localhost
"::1",
}

…and render it using godoc:

% go get -u golang.org/x/tools/cmd/godoc
% go get -u github.com/stapelberg/godoc-exported
% godoc -http=localhost:6060
% google-chrome http://localhost:6060/pkg/github.com/stapelberg/godoc-exported/

You’ll see:

2019-01-16-202035_703x617_scrot

I.e., the comments are not printed.

I’m guessing this is a consequence of go/ast’s comment handling being tricky. I tried taking a stab at it, but couldn’t get very far, so I figured I’d file a bug and see if someone more familiar with the code can advise what needs to be done here.

@stapelberg
Copy link
Contributor Author

This also affects godoc.org: https://godoc.org/github.com/stapelberg/godoc-exported

@gopherbot gopherbot added this to the Unreleased milestone Jan 16, 2019
@agnivade
Copy link
Contributor

I think this has been raised before in the past, but I couldn't find an exact issue for this. Maybe #20744 ?

@griesemer

@griesemer
Copy link
Contributor

#20744 is a catch-all issue for all these but it's not godoc specific. We're aware of the issue but we need to resolve #20744 first which is a significant project to get right. Unfortunately it's not high priority at the moment.

@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 28, 2019
@julieqiu
Copy link
Member

/cc @dmitshur

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants