Skip to content

Commit 1a50ff5

Browse files
committed
Add nolint directives
Silence golangci-lint v2.4 errors that we don't want to fix. Signed-off-by: Markus Lehtonen <[email protected]>
1 parent 00fa1a1 commit 1a50ff5

6 files changed

Lines changed: 15 additions & 2 deletions

File tree

pkg/adaptation/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
//
2626

2727
// Aliased request/response/event types for api/api.proto.
28+
//
29+
//nolint:revive // revive thinks the comment is for the exported type below
2830
type (
2931
RegisterPluginRequest = api.RegisterPluginRequest
3032
RegisterPluginResponse = api.Empty
@@ -134,6 +136,8 @@ const (
134136
)
135137

136138
// Aliased types for api/optional.go.
139+
//
140+
//nolint:revive // revive thinks the comment is for the exported type below
137141
type (
138142
OptionalString = api.OptionalString
139143
OptionalInt = api.OptionalInt

pkg/adaptation/builtin/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ import (
2424

2525
// BuiltinPlugin implements the NRI API and runs in-process
2626
// within the container runtime.
27+
//
28+
//nolint:revive // tautology builtin.Builtin*
2729
type BuiltinPlugin struct {
2830
Base string
2931
Index string
3032
Handlers BuiltinHandlers
3133
}
3234

3335
// BuiltinHandlers contains request handlers for the builtin plugin.
36+
//
37+
//nolint:revive // tautology builtin.Builtin*
3438
type BuiltinHandlers struct {
3539
Configure func(context.Context, *api.ConfigureRequest) (*api.ConfigureResponse, error)
3640
Synchronize func(context.Context, *api.SynchronizeRequest) (*api.SynchronizeResponse, error)

pkg/api/event.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
ValidEvents = EventMask((1 << (Event_LAST - 1)) - 1)
2727
)
2828

29+
//nolint:revive // exported type should have comment
2930
type (
3031
// Define *Request/*Response type aliases for *Event/Empty pairs.
3132

pkg/api/owners.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
limitations under the License.
1515
*/
1616

17+
// TODO: Add comments to exported methods and functions.
18+
//
19+
//nolint:revive // exported symbols should have comments
1720
package api
1821

1922
import (

pkg/api/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func CheckPluginIndex(idx string) error {
5151
if len(idx) != 2 {
5252
return fmt.Errorf("invalid plugin index %q, must be 2 digits", idx)
5353
}
54+
//nolint:staticcheck // could apply De Morgan's law
5455
if !('0' <= idx[0] && idx[0] <= '9') || !('0' <= idx[1] && idx[1] <= '9') {
5556
return fmt.Errorf("invalid plugin index %q (not [0-9][0-9])", idx)
5657
}

pkg/api/strip.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (c *LinuxCPU) Strip() *LinuxCPU {
223223
return nil
224224
}
225225

226-
empty := true
226+
empty := true //nolint:staticcheck // could merge conditional assignment below to variable definition
227227

228228
if c.Shares != nil {
229229
empty = false
@@ -262,7 +262,7 @@ func (m *LinuxMemory) Strip() *LinuxMemory {
262262
return nil
263263
}
264264

265-
empty := true
265+
empty := true //nolint:staticcheck // could merge conditional assignment below to variable definition
266266

267267
if m.Limit != nil {
268268
empty = false

0 commit comments

Comments
 (0)