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

Comments

@stapelberg
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

@gopherbot gopherbot added this to the Unreleased milestone Jan 16, 2019

@agnivade

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented May 28, 2019

/cc @dmitshur

@gopherbot gopherbot added the Tools label Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.