Преглед изворни кода

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 4f0834668696c981ef56ee77dc7af05bf3d0dbf9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e34ab5200d3c3cd985a1902c3dcd6cf5defc934f)
Signed-off-by: Cory Snider <csnider@mirantis.com>
Sebastiaan van Stijn пре 3 година
родитељ
комит
9a5d1b295e
2 измењених фајлова са 4 додато и 2 уклоњено
  1. 2 1
      pkg/devicemapper/devmapper.go
  2. 2 1
      volume/drivers/extpoint.go

+ 2 - 1
pkg/devicemapper/devmapper.go

@@ -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

+ 2 - 1
volume/drivers/extpoint.go

@@ -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)