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

x/tools/godoc: does not print comments accompanying variable literals #29775

stapelberg opened this issue Jan 16, 2019 · 4 comments

Comments

@stapelberg
Copy link
Contributor

@stapelberg stapelberg commented Jan 16, 2019

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

@stapelberg stapelberg commented Jan 16, 2019

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

@agnivade agnivade commented Jan 17, 2019

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

@griesemer griesemer commented Jan 17, 2019

#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
Copy link
Contributor

@julieqiu julieqiu commented May 28, 2019

/cc @dmitshur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants