Skip to content

Conversation

thaJeztah
Copy link
Member

The correct formatting for machine-readable comments is;

//<some alphanumeric identifier>:<options>[,<option>...][ // comment]

Which basically means:

  • MUST NOT have a space before <identifier> (e.g. nolint)
  • Identified MUST be alphanumeric
  • MUST be followed by a colon
  • MUST be followed by at least one <option>
  • Optionally additional <options> (comma-separated)
  • Optionally followed by a comment

Any other format will not be considered a machine-readable comment by gofmt,
and thus formatted as a regular comment. Note that this also means that a
//nolint (without anything after it) is considered invalid, same for //#nosec
(starts with a #).

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

The correct formatting for machine-readable comments is;

    //<some alphanumeric identifier>:<options>[,<option>...][ // comment]

Which basically means:

- MUST NOT have a space before `<identifier>` (e.g. `nolint`)
- Identified MUST be alphanumeric
- MUST be followed by a colon
- MUST be followed by at least one `<option>`
- Optionally additional `<options>` (comma-separated)
- Optionally followed by a comment

Any other format will not be considered a machine-readable comment by `gofmt`,
and thus formatted as a regular comment. Note that this also means that a
`//nolint` (without anything after it) is considered invalid, same for `//#nosec`
(starts with a `#`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants