Skip to content

Commit eb5df6e

Browse files
authored
Merge pull request #316 from NVIDIA/golangci-lint-v2
[CI] migrate to golangci-lint v2
2 parents 93cd479 + 9d697d7 commit eb5df6e

File tree

6 files changed

+39
-22
lines changed

6 files changed

+39
-22
lines changed

.github/workflows/golang.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
go-version: ${{ inputs.golang_versions }}
3535

3636
- name: Lint
37-
uses: golangci/golangci-lint-action@v6
37+
uses: golangci/golangci-lint-action@v7
3838
with:
3939
version: latest
4040
args: -v --timeout 5m

.golangci.yaml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
1-
# please keep this alphabetized
1+
version: "2"
2+
run:
3+
tests: true
24
linters:
35
enable:
46
- asciicheck
57
- contextcheck
68
- forcetypeassert
79
- gocritic
810
- godot
11+
- misspell
12+
- staticcheck
13+
exclusions:
14+
generated: lax
15+
presets:
16+
- comments
17+
- common-false-positives
18+
- legacy
19+
- std-error-handling
20+
paths:
21+
- third_party$
22+
- builtin$
23+
- examples$
24+
formatters:
25+
enable:
926
- gofmt
1027
- goimports
11-
- misspell
12-
- stylecheck
13-
14-
run:
15-
tests: true
16-
timeout: 10m
17-
18-
linters-settings:
19-
goimports:
20-
local-prefixes: "github.com/NVIDIA/k8s-dra-driver-gpu"
28+
settings:
29+
goimports:
30+
local-prefixes:
31+
- github.com/NVIDIA/k8s-dra-driver-gpu
32+
exclusions:
33+
generated: lax
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$

cmd/compute-domain-kubelet-plugin/cdi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ func (cdi *CDIHandler) CreateStandardDeviceSpecFile(allocatable AllocatableDevic
161161
// Make sure that NVIDIA_VISIBLE_DEVICES is set to void to avoid the
162162
// nvidia-container-runtime honoring it in addition to the underlying
163163
// runtime honoring CDI.
164-
commonEdits.ContainerEdits.Env = append(
165-
commonEdits.ContainerEdits.Env,
164+
commonEdits.Env = append(
165+
commonEdits.Env,
166166
"NVIDIA_VISIBLE_DEVICES=void")
167167

168168
// Generate device specs for all devices.

cmd/compute-domain-kubelet-plugin/device_state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,19 +502,19 @@ func GetOpaqueDeviceConfigs(
502502
for _, config := range candidateConfigs {
503503
// If this is nil, the driver doesn't support some future API extension
504504
// and needs to be updated.
505-
if config.DeviceConfiguration.Opaque == nil {
505+
if config.Opaque == nil {
506506
return nil, fmt.Errorf("only opaque parameters are supported by this driver")
507507
}
508508

509509
// Configs for different drivers may have been specified because a
510510
// single request can be satisfied by different drivers. This is not
511511
// an error -- drivers must skip over other driver's configs in order
512512
// to support this.
513-
if config.DeviceConfiguration.Opaque.Driver != driverName {
513+
if config.Opaque.Driver != driverName {
514514
continue
515515
}
516516

517-
decodedConfig, err := runtime.Decode(decoder, config.DeviceConfiguration.Opaque.Parameters.Raw)
517+
decodedConfig, err := runtime.Decode(decoder, config.Opaque.Parameters.Raw)
518518
if err != nil {
519519
return nil, fmt.Errorf("error decoding config parameters: %w", err)
520520
}

cmd/gpu-kubelet-plugin/cdi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ func (cdi *CDIHandler) CreateStandardDeviceSpecFile(allocatable AllocatableDevic
159159
// Make sure that NVIDIA_VISIBLE_DEVICES is set to void to avoid the
160160
// nvidia-container-runtime honoring it in addition to the underlying
161161
// runtime honoring CDI.
162-
commonEdits.ContainerEdits.Env = append(
163-
commonEdits.ContainerEdits.Env,
162+
commonEdits.Env = append(
163+
commonEdits.Env,
164164
"NVIDIA_VISIBLE_DEVICES=void")
165165

166166
// Generate device specs for all full GPUs and MIG devices.

cmd/gpu-kubelet-plugin/device_state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,19 +446,19 @@ func GetOpaqueDeviceConfigs(
446446
for _, config := range candidateConfigs {
447447
// If this is nil, the driver doesn't support some future API extension
448448
// and needs to be updated.
449-
if config.DeviceConfiguration.Opaque == nil {
449+
if config.Opaque == nil {
450450
return nil, fmt.Errorf("only opaque parameters are supported by this driver")
451451
}
452452

453453
// Configs for different drivers may have been specified because a
454454
// single request can be satisfied by different drivers. This is not
455455
// an error -- drivers must skip over other driver's configs in order
456456
// to support this.
457-
if config.DeviceConfiguration.Opaque.Driver != driverName {
457+
if config.Opaque.Driver != driverName {
458458
continue
459459
}
460460

461-
decodedConfig, err := runtime.Decode(decoder, config.DeviceConfiguration.Opaque.Parameters.Raw)
461+
decodedConfig, err := runtime.Decode(decoder, config.Opaque.Parameters.Raw)
462462
if err != nil {
463463
return nil, fmt.Errorf("error decoding config parameters: %w", err)
464464
}

0 commit comments

Comments
 (0)