fix formatting of "nolint" tags for go1.19

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>
(cherry picked from commit 4f08346686)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e34ab5200d)
Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Sebastiaan van Stijn 2022-07-13 22:30:47 +02:00 committed by Cory Snider
parent c8c40abbba
commit 9a5d1b295e
2 changed files with 4 additions and 2 deletions

View file

@ -15,7 +15,8 @@ import (
)
// Same as DM_DEVICE_* enum values from libdevmapper.h
// nolint: deadcode,unused,varcheck
//
//nolint:deadcode,unused,varcheck
const (
deviceCreate TaskType = iota
deviceReload

View file

@ -21,7 +21,8 @@ const extName = "VolumeDriver"
// volumeDriver defines the available functions that volume plugins must implement.
// This interface is only defined to generate the proxy objects.
// It's not intended to be public or reused.
// nolint: deadcode,unused,varcheck
//
//nolint:deadcode,unused,varcheck
type volumeDriver interface {
// Create a volume with the given name
Create(name string, opts map[string]string) (err error)