-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
go/doc: drop //go:* comments from extracted docs #37974
Comments
Change https://golang.org/cl/224737 mentions this issue: |
https://golang.org/cl/224737 implements the change, for reference. |
Adding to the minutes for the first time this week, but it seems headed for a likely accept based on the reactions so far. |
Would this also apply to other machine-readable comments (not prefixed with |
I don't think |
That's a very rudimentary way to ignore linter messages that doesn't scale. Having them be explicitly in the code is very common (tslint/eslint ignores, JetBrain's style ignores, others) and means they're version controllable, configurable per-instance, available in the editor (gopls has staticcheck built in!), and so on. I wouldn't suggest changing how a CI system checks linter messages just to fix generated documentation including unwanted comments. That'd be backwards. One thing I will say is that comments without a space after |
It wouldn't have any awareness of the linter comment syntax, just that |
I implemented Right now I have Are there any objections to doing either of these options? |
I ran the following in my mod cache:
This was the output: https://gist.github.com/zikaeroh/463b4c8bda2c602587c60d450acbc1a5 Everything there looks good to me. I don't see any false positives (besides two I think that regex is likely to be enough. The only thing I'd consider is adding But, my cache is only a subset of projects. |
What is the motivation to replace the "go" part with |
Ideally I would have gone for |
Yeah, that's unfortunate, though I believe in those cases you can put the // SomeFunc does something.
func SomeFunc() { //nolint
...
} And I believe at least golangci-lint would accept that. Not sure past that.
It's a shame |
There was some discussion in response to my question in #37974 (comment), but I don't see any objections. Based on the discussion, then, this seems like a likely accept. |
No change in consensus, so accepted. |
should the isDirective check also handle |
@nd Would you mind opening a new issue for that? Thanks. |
Filed #38785. |
This allows writing // F does a thing. //go:noinline func F() without the //go:noinline or other directive (such as //line) ending up looking like extra words in the doc comment. Fixes golang#37974. Change-Id: Ic738d72802cc2fa448f7633915e7126d2f76d8ca Reviewed-on: https://go-review.googlesource.com/c/go/+/224737 Reviewed-by: Robert Griesemer <gri@golang.org>
It's been a long time coming but the ast package is now treating directives as a special case and removing them from comment groups. See golang/go#37974 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
It's been a long time coming but the ast package is now treating directives as a special case and removing them from comment groups. See golang/go#37974 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
It's been a long time coming but the ast package is now treating directives as a special case and removing them from comment groups. See golang/go#37974 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
It's been a long time coming but the ast package is now treating directives as a special case and removing them from comment groups. See golang/go#37974 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
Today we write things like:
instead of the more natural:
because the latter produces:
Now that we have the //go: convention, let's fix go/doc to leave them out automatically,
and then we can write things the more natural way without cluttering docs.
I'm happy to do the work.
/cc @griesemer
The text was updated successfully, but these errors were encountered: