Skip to content

Commit d5d1d45

Browse files
authored
Merge pull request bottlerocket-os#832 from vigh-m/golangci-fix
Update golangci-lint
2 parents 6754af6 + c1da085 commit d5d1d45

4 files changed

Lines changed: 34 additions & 22 deletions

File tree

.github/workflows/golangci-lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
go-version: 1.21
2020
- uses: actions/checkout@v4
2121
- name: lint-host-ctr
22-
uses: golangci/golangci-lint-action@v6
22+
uses: golangci/golangci-lint-action@v9
2323
with:
2424
version: latest
2525
working-directory: sources/host-ctr
2626
- name: lint-ecs-gpu-init
27-
uses: golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@v9
2828
with:
2929
version: latest
3030
working-directory: sources/ecs-gpu-init

.golangci.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1+
version: "2"
12
linters:
23
enable:
3-
- errcheck
4-
- goimports
5-
- ineffassign
64
- misspell
75
- revive
8-
- staticcheck
96
- unconvert
10-
- unused
11-
- govet
12-
13-
run:
14-
timeout: 3m
15-
issues:
16-
exclude-dirs:
17-
- vendor
18-
- .gomodcache
7+
exclusions:
8+
generated: lax
9+
presets:
10+
- comments
11+
- common-false-positives
12+
- legacy
13+
- std-error-handling
14+
paths:
15+
- vendor
16+
- .gomodcache
17+
- third_party$
18+
- builtin$
19+
- examples$
20+
formatters:
21+
enable:
22+
- goimports
23+
exclusions:
24+
generated: lax
25+
paths:
26+
- vendor
27+
- .gomodcache
28+
- third_party$
29+
- builtin$
30+
- examples$

sources/ecs-gpu-init/cmd/ecs-gpu-init/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func main() {
2323
// GenerateGPUInfoConfig generates the configuration used by the ECS agent
2424
func generateGPUInfoConfig() error {
2525
if ret := nvml.Init(); ret != nvml.SUCCESS {
26-
return fmt.Errorf("Failed to initialize NVML, got ret %v", ret)
26+
return fmt.Errorf("failed to initialize NVML, got ret %v", ret)
2727
}
2828
defer func() {
2929
ret := nvml.Shutdown()
@@ -34,7 +34,7 @@ func generateGPUInfoConfig() error {
3434

3535
version, ret := nvml.SystemGetDriverVersion()
3636
if ret != nvml.SUCCESS {
37-
return fmt.Errorf("Failed to get version, got ret %v", ret)
37+
return fmt.Errorf("failed to get version, got ret %v", ret)
3838
}
3939
gpuIDs, err := getGPUDeviceIDs()
4040
if err != nil {
@@ -48,7 +48,7 @@ func generateGPUInfoConfig() error {
4848
func getGPUDeviceIDs() ([]string, error) {
4949
count, ret := nvml.DeviceGetCount()
5050
if ret != nvml.SUCCESS {
51-
return nil, fmt.Errorf("Failed to get device count, got ret %v", ret)
51+
return nil, fmt.Errorf("failed to get device count, got ret %v", ret)
5252
}
5353
var (
5454
gpuIDs []string
@@ -63,7 +63,7 @@ func getGPUDeviceIDs() ([]string, error) {
6363
gpuIDs = append(gpuIDs, uuid)
6464
}
6565
if len(errors) > 0 {
66-
return nil, fmt.Errorf("Found errors while initializing devices: %s", errors)
66+
return nil, fmt.Errorf("found errors while initializing devices: %s", errors)
6767
}
6868
return gpuIDs, nil
6969
}
@@ -92,11 +92,11 @@ func writeGPUInfo(version string, gpuIDs []string) error {
9292
func getDeviceUUID(idx int) (string, error) {
9393
d, ret := nvml.DeviceGetHandleByIndex(idx)
9494
if ret != nvml.SUCCESS {
95-
return "", fmt.Errorf("Failed to get device at index %d, got ret %v", idx, ret)
95+
return "", fmt.Errorf("failed to get device at index %d, got ret %v", idx, ret)
9696
}
9797
uuid, ret := d.GetUUID()
9898
if ret != nvml.SUCCESS {
99-
return "", fmt.Errorf("Failed to get UUID for device at index %d, got ret %v", idx, ret)
99+
return "", fmt.Errorf("failed to get UUID for device at index %d, got ret %v", idx, ret)
100100
}
101101

102102
return uuid, nil

sources/host-ctr/cmd/host-ctr/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ func runCtr(containerdSocket string, namespace string, containerID string, sourc
509509

510510
// Return error if container exists with non-zero status
511511
if code != 0 {
512-
return fmt.Errorf("Container %s exited with non-zero status", containerID)
512+
return fmt.Errorf("container %s exited with non-zero status", containerID)
513513
}
514514

515515
return nil

0 commit comments

Comments
 (0)