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/go: Documentation for "import comment" suggests an impossible comment form. #16030

Closed
dmitshur opened this issue Jun 10, 2016 · 2 comments
Closed

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Jun 10, 2016

The documentation of cmd/go has a section on import path checking that currently says:

A package statement is said to have an "import comment" if it is immediately followed (before the next newline) by a comment of one of these two forms:

package math // import "path"
package math /* import "path" * /

Note the space in the closing * /. What the documentation is trying to say is actually */, but due to a technical limitation it says something else instead. The problem is that including a */ inside the package comment would end it short, causing alldocs.go file to have syntax errors:

package math /* import "path" * /

The end result is that documentation (specification) of import comments can be confusing, especially for beginners. The documentation should be truthful and say:

... a comment of one of these two forms:

package math // import "path"
package math /* import "path" */

I propose fixing this by using line comments rather than general comments (also known as block comments) for the generated documentation in alldocs.go. Line comments scale better and can include any characters. General comments cannot contain */ character sequence.

I have it implemented, I will submit a CL that resolves this soon.

@gopherbot
Copy link

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

@dmitshur
Copy link
Contributor Author

I've made https://golang.org/cl/23968 that fixes this issue.

Here's the godoc for cmd/go before that change:

image

And here's after:

image

@ianlancetaylor ianlancetaylor added this to the Go1.7Maybe milestone Jun 10, 2016
@golang golang locked and limited conversation to collaborators Jun 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants