package-comment-form
What it does
Section titled “What it does”Reports a package comment whose first line does not start with Package and the name of the package. A comment of the right form with a blank line before the package clause is reported as detached. A file of package main is not checked.
Why it matters
Section titled “Why it matters”Documentation tools read the first sentence of the package comment as the package’s summary, and a fixed form makes the summaries of all packages read the same. A blank line between the comment and the package clause makes the comment a plain comment, not the package’s documentation.
To fix, start with Package name and remove the blank line.
Example
Section titled “Example”// Does things.package aConfiguration
Section titled “Configuration”go: lint: rules: package-comment-form: warn # off (default), warn, errorEnabled by the presets: go/revive.
Suppress one line with sudsy-disable-next-line package-comment-form in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| revive | package-comments |
partial | 52 findings are missed where a generated or build-excluded sibling that revive does not load holds the first file name or the only comment |