Skip to content

Commit bd9c6f3

Browse files
authored
update Go 1.24 and latest linter rules; fix linter errors (#266)
* update Go 1.24 and latest linter rules; fix linter errors * update Go version to 1.24 in CodeQL analysis and Dockerfile
1 parent d34ff3d commit bd9c6f3

File tree

14 files changed

+89
-88
lines changed

14 files changed

+89
-88
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Go Environment
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version: '1.21'
25+
go-version: '1.24'
2626
cache: true
2727
cache-dependency-path: go.sum
2828
- name: Run Lint and Test Coverage

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Go
4040
uses: actions/setup-go@v5
4141
with:
42-
go-version: '1.21'
42+
go-version: '1.24'
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Set Up Go
3030
uses: actions/setup-go@v5
3131
with:
32-
go-version: '1.21'
32+
go-version: '1.24'
3333
cache: true
3434
cache-dependency-path: go.sum
3535
- name: Build Release Binaries

.golangci.yaml

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
run:
2-
# which dirs to skip
3-
skip-dirs:
4-
- mocks
52
# Timeout for analysis, e.g. 30s, 5m.
63
# Default: 1m
74
timeout: 5m
@@ -15,12 +12,12 @@ run:
1512
allow-parallel-runners: true
1613

1714
linters-settings:
18-
govet:
19-
check-shadowing: true
15+
# shadow linter replaces govet's check-shadowing
16+
shadow:
17+
strict: false
2018
gocyclo:
2119
min-complexity: 15
22-
maligned:
23-
suggest-new: true
20+
# maligned is deprecated
2421
dupl:
2522
threshold: 100
2623
goconst:
@@ -72,7 +69,6 @@ linters:
7269
- errorlint
7370
- exhaustive
7471
# - exhaustivestruct TODO: check how to fix it
75-
- exportloopref
7672
# - forbidigo TODO: configure forbidden code patterns
7773
# - forcetypeassert
7874
- funlen
@@ -84,10 +80,10 @@ linters:
8480
- gocritic
8581
- gocyclo
8682
# - godox
87-
- goerr113
83+
- err113
8884
- gofmt
8985
- goimports
90-
- gomnd
86+
- mnd
9187
# - gomoddirectives
9288
- gosec
9389
- gosimple
@@ -117,7 +113,7 @@ linters:
117113
# - staticcheck doesn't work with go1.19
118114
# - structcheck disabled because of generics
119115
- stylecheck
120-
- tenv
116+
- usetesting
121117
- testableexamples
122118
- typecheck
123119
- unconvert
@@ -127,10 +123,13 @@ linters:
127123
# - varcheck depricated 1.49
128124
# - wastedassign disabled because of generics
129125
- whitespace
130-
- wrapcheck
126+
# - wrapcheck # Temporarily disabled due to false positives
131127
# - wsl
132128

133129
issues:
130+
# Exclude specific directories from linting
131+
exclude-dirs:
132+
- mocks
134133
exclude-rules:
135134
- path: _test\.go
136135
linters:

.pre-commit-config.yaml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-added-large-files
66
- repo: https://github.com/jumanjihouse/pre-commit-hooks
77
rev: 3.0.0
88
hooks:
99
- id: git-dirty
1010
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
11-
rev: v2.4.0
11+
rev: v2.14.0
1212
hooks:
1313
- id: pretty-format-golang
14+
additional_dependencies:
15+
- setuptools # Add this line
1416
- repo: https://github.com/mattlqx/pre-commit-sign
15-
rev: v1.1.3
17+
rev: v1.2.0
1618
hooks:
1719
- id: sign-commit
1820
- repo: https://github.com/syntaqx/git-hooks
19-
rev: v0.0.17
21+
rev: v0.0.18
2022
hooks:
2123
- id: forbid-binary
24+
exclude: ^docs/img/ # Exclude all files in docs/img directory
2225
- id: go-test
2326
- id: go-mod-tidy
2427
- repo: local
@@ -27,4 +30,4 @@ repos:
2730
name: lint-check
2831
entry: make lint
2932
language: system
30-
files: \.go
33+
files: \.go

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ release: clean ; $(info $(M) building binaries for multiple os/arch...) @ ## Bui
6767
setup-tools: setup-lint setup-gocov setup-gocov-xml setup-go-junit-report
6868

6969
setup-lint:
70-
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
70+
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
7171
setup-gocov:
7272
$(GO) install github.com/axw/gocov/[email protected]
7373
setup-gocov-xml:
7474
$(GO) install github.com/AlekSi/gocov-xml@latest
7575
setup-go-junit-report:
7676
$(GO) install github.com/jstemmer/go-junit-report/v2@latest
7777
setup-mockery:
78-
$(GO) get github.com/vektra/mockery/v2@v2.40.3
78+
$(GO) install github.com/vektra/mockery/v2@latest
7979

8080
# Tests
8181

docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# ----- Go Builder Image ------
33
#
4-
FROM --platform=$BUILDPLATFORM golang:1.21 AS builder
4+
FROM --platform=$BUILDPLATFORM golang:1.24 AS builder
55

66
# curl git bash
77
RUN apt-get update && apt-get install -y --no-install-recommends \

go.mod

+10-11
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,34 @@ module github.com/alexei-led/pumba
22

33
require (
44
github.com/docker/docker v23.0.3+incompatible
5-
github.com/docker/go-connections v0.4.0
6-
github.com/johntdyer/slackrus v0.0.0-20210521205746-42486fb4c48c
7-
github.com/opencontainers/image-spec v1.1.0-rc4
5+
github.com/docker/go-connections v0.5.0
6+
github.com/johntdyer/slackrus v0.0.0-20230315191314-80bc92dee4fc
7+
github.com/opencontainers/image-spec v1.1.1
88
github.com/pkg/errors v0.9.1
99
github.com/sirupsen/logrus v1.9.3
10-
github.com/stretchr/testify v1.8.4
11-
github.com/urfave/cli v1.22.12
12-
golang.org/x/sync v0.6.0
10+
github.com/stretchr/testify v1.10.0
11+
github.com/urfave/cli v1.22.16
12+
golang.org/x/sync v0.12.0
1313
)
1414

1515
require (
1616
github.com/Microsoft/go-winio v0.6.1 // indirect
17-
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
17+
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
1818
github.com/davecgh/go-spew v1.1.1 // indirect
1919
github.com/docker/distribution v2.8.2+incompatible // indirect
2020
github.com/docker/go-units v0.5.0 // indirect
2121
github.com/gogo/protobuf v1.3.2 // indirect
2222
github.com/google/go-cmp v0.5.9 // indirect
23-
github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22 // indirect
23+
github.com/johntdyer/slack-go v0.0.0-20230314151037-c5bf334f9b6e // indirect
2424
github.com/kr/text v0.2.0 // indirect
2525
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
2626
github.com/morikuni/aec v1.0.0 // indirect
2727
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
2828
github.com/opencontainers/go-digest v1.0.0 // indirect
2929
github.com/pmezard/go-difflib v1.0.0 // indirect
3030
github.com/russross/blackfriday/v2 v2.1.0 // indirect
31-
github.com/stretchr/objx v0.5.0 // indirect
31+
github.com/stretchr/objx v0.5.2 // indirect
3232
golang.org/x/mod v0.14.0 // indirect
33-
golang.org/x/net v0.20.0 // indirect
3433
golang.org/x/sys v0.16.0 // indirect
3534
golang.org/x/time v0.1.0 // indirect
3635
golang.org/x/tools v0.17.0 // indirect
@@ -39,4 +38,4 @@ require (
3938
gotest.tools/v3 v3.0.2 // indirect
4039
)
4140

42-
go 1.21
41+
go 1.24

go.sum

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
22
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
3-
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
3+
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
44
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
55
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
6-
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
7-
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
6+
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
7+
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
88
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
99
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1010
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -14,8 +14,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3
1414
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
1515
github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho=
1616
github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
17-
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
18-
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
17+
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
18+
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
1919
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
2020
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
2121
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -24,10 +24,10 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
2424
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
2525
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
2626
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
27-
github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22 h1:jKUP9TQ0c7X3w6+IPyMit07RE42MtTWNd77sN2cHngQ=
28-
github.com/johntdyer/slack-go v0.0.0-20180213144715-95fac1160b22/go.mod h1:u0Jo4f2dNlTJeeOywkM6bLwxq6gC3pZ9rEFHn3AhTdk=
29-
github.com/johntdyer/slackrus v0.0.0-20210521205746-42486fb4c48c h1:4eD0DM7IEOQI5egyzKdPXncs61BxMtYwwzJPCRQFU0Y=
30-
github.com/johntdyer/slackrus v0.0.0-20210521205746-42486fb4c48c/go.mod h1:j1kV/8f3jowErEq4XyeypkCdvg5EeHkf0YCKCcq5Ybo=
27+
github.com/johntdyer/slack-go v0.0.0-20230314151037-c5bf334f9b6e h1:5tRmeUw/tXT/DvaoloWTWwlyrEZrKA7pnrz/X+g9s34=
28+
github.com/johntdyer/slack-go v0.0.0-20230314151037-c5bf334f9b6e/go.mod h1:u0Jo4f2dNlTJeeOywkM6bLwxq6gC3pZ9rEFHn3AhTdk=
29+
github.com/johntdyer/slackrus v0.0.0-20230315191314-80bc92dee4fc h1:enUIjGI+ljPLV2X3Mu3noR0P3m2NaIFGRsp96J8RBio=
30+
github.com/johntdyer/slackrus v0.0.0-20230315191314-80bc92dee4fc/go.mod h1:EM3NFHkhmCX05s6UvxWSJ8h/3mluH4tF6bYr9FXF1Cg=
3131
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
3232
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
3333
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -42,8 +42,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
4242
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
4343
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
4444
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
45-
github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0=
46-
github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
45+
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
46+
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
4747
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4848
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4949
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -56,16 +56,18 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
5656
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
5757
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
5858
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
59-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
6059
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
60+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
61+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
6162
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
6263
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
6364
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
64-
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
65-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
6665
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
67-
github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8=
68-
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
66+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
67+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
68+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
69+
github.com/urfave/cli v1.22.16 h1:MH0k6uJxdwdeWQTwhSO42Pwr4YLrNLwBtg1MRgTqPdQ=
70+
github.com/urfave/cli v1.22.16/go.mod h1:EeJR6BKodywf4zciqrdw6hpCPk68JO9z5LazXZMn5Po=
6971
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
7072
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
7173
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -80,13 +82,11 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
8082
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
8183
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
8284
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
83-
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
84-
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
8585
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
8686
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
8787
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
88-
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
89-
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
88+
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
89+
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
9090
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
9191
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9292
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

pkg/chaos/docker/kill.go

+23-23
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ var linuxSignals = map[string]syscall.Signal{
2323
"SIGQUIT": syscall.SIGQUIT,
2424
"SIGILL": syscall.SIGILL,
2525
"SIGTRAP": syscall.SIGTRAP,
26-
"SIGIOT": syscall.Signal(0x6), //nolint:gomnd // SIGIOT (use number since this signal is not defined for Windows)
26+
"SIGIOT": syscall.Signal(0x6), //nolint:mnd // SIGIOT (use number since this signal is not defined for Windows)
2727
"SIGBUS": syscall.SIGBUS,
2828
"SIGFPE": syscall.SIGFPE,
2929
"SIGKILL": syscall.SIGKILL,
30-
"SIGUSR1": syscall.Signal(0x1e), //nolint:gomnd // SIGUSR1 (use number since this signal is not defined for Windows)
30+
"SIGUSR1": syscall.Signal(0x1e), //nolint:mnd // SIGUSR1 (use number since this signal is not defined for Windows)
3131
"SIGSEGV": syscall.SIGSEGV,
32-
"SIGUSR2": syscall.Signal(0x1f), //nolint:gomnd // SIGUSR2 (use number since this signal is not defined for Windows)
32+
"SIGUSR2": syscall.Signal(0x1f), //nolint:mnd // SIGUSR2 (use number since this signal is not defined for Windows)
3333
"SIGPIPE": syscall.SIGPIPE,
3434
"SIGALRM": syscall.SIGALRM,
3535
"SIGTERM": syscall.SIGTERM,
36-
"SIGCHLD": syscall.Signal(0x14), //nolint:gomnd // SIGCHLD (use number since this signal is not defined for Windows)
37-
"SIGCONT": syscall.Signal(0x13), //nolint:gomnd // SIGCONT (use number since this signal is not defined for Windows)
38-
"SIGSTOP": syscall.Signal(0x11), //nolint:gomnd // SIGSTOP (use number since this signal is not defined for Windows)
39-
"SIGTSTP": syscall.Signal(0x12), //nolint:gomnd // SIGTSTP (use number since this signal is not defined for Windows)
40-
"SIGTTIN": syscall.Signal(0x15), //nolint:gomnd // SIGTTIN (use number since this signal is not defined for Windows)
41-
"SIGTTOU": syscall.Signal(0x16), //nolint:gomnd // SIGTTOU (use number since this signal is not defined for Windows)
42-
"SIGURG": syscall.Signal(0x10), //nolint:gomnd // SIGURG (use number since this signal is not defined for Windows)
43-
"SIGXCPU": syscall.Signal(0x18), //nolint:gomnd // SIGXCPU (use number since this signal is not defined for Windows)
44-
"SIGXFSZ": syscall.Signal(0x19), //nolint:gomnd // SIGXFSZ (use number since this signal is not defined for Windows)
45-
"SIGVTALRM": syscall.Signal(0x1a), //nolint:gomnd // SIGVTALRM (use number since this signal is not defined for Windows)
46-
"SIGPROF": syscall.Signal(0x1b), //nolint:gomnd // SIGPROF (use number since this signal is not defined for Windows)
47-
"SIGWINCH": syscall.Signal(0x1c), //nolint:gomnd // SIGWINCH (use number since this signal is not defined for Windows)
48-
"SIGIO": syscall.Signal(0x17), //nolint:gomnd // SIGIO (use number since this signal is not defined for Windows)
36+
"SIGCHLD": syscall.Signal(0x14), //nolint:mnd // SIGCHLD (use number since this signal is not defined for Windows)
37+
"SIGCONT": syscall.Signal(0x13), //nolint:mnd // SIGCONT (use number since this signal is not defined for Windows)
38+
"SIGSTOP": syscall.Signal(0x11), //nolint:mnd // SIGSTOP (use number since this signal is not defined for Windows)
39+
"SIGTSTP": syscall.Signal(0x12), //nolint:mnd // SIGTSTP (use number since this signal is not defined for Windows)
40+
"SIGTTIN": syscall.Signal(0x15), //nolint:mnd // SIGTTIN (use number since this signal is not defined for Windows)
41+
"SIGTTOU": syscall.Signal(0x16), //nolint:mnd // SIGTTOU (use number since this signal is not defined for Windows)
42+
"SIGURG": syscall.Signal(0x10), //nolint:mnd // SIGURG (use number since this signal is not defined for Windows)
43+
"SIGXCPU": syscall.Signal(0x18), //nolint:mnd // SIGXCPU (use number since this signal is not defined for Windows)
44+
"SIGXFSZ": syscall.Signal(0x19), //nolint:mnd // SIGXFSZ (use number since this signal is not defined for Windows)
45+
"SIGVTALRM": syscall.Signal(0x1a), //nolint:mnd // SIGVTALRM (use number since this signal is not defined for Windows)
46+
"SIGPROF": syscall.Signal(0x1b), //nolint:mnd // SIGPROF (use number since this signal is not defined for Windows)
47+
"SIGWINCH": syscall.Signal(0x1c), //nolint:mnd // SIGWINCH (use number since this signal is not defined for Windows)
48+
"SIGIO": syscall.Signal(0x17), //nolint:mnd // SIGIO (use number since this signal is not defined for Windows)
4949
}
5050

5151
// `docker kill` command
@@ -98,22 +98,22 @@ func (k *killCommand) Run(ctx context.Context, random bool) error {
9898
return nil
9999
}
100100

101-
// select single random container from matching container and replace list with selected item
101+
// select single random ctr from matching ctr and replace list with selected item
102102
if random {
103103
if c := container.RandomContainer(containers); c != nil {
104104
containers = []*container.Container{c}
105105
}
106106
}
107107

108-
for _, container := range containers {
108+
for _, ctr := range containers {
109109
log.WithFields(log.Fields{
110-
"container": container,
111-
"signal": k.signal,
112-
}).Debug("killing container")
113-
c := container
110+
"ctr": ctr,
111+
"signal": k.signal,
112+
}).Debug("killing ctr")
113+
c := ctr
114114
err = k.client.KillContainer(ctx, c, k.signal, k.dryRun)
115115
if err != nil {
116-
return errors.Wrap(err, "failed to kill container")
116+
return errors.Wrap(err, "failed to kill ctr")
117117
}
118118
}
119119
return nil

0 commit comments

Comments
 (0)