Skip to content

Commit 2c9554f

Browse files
committed
Bump Go to 1.23, fix lint, disable gosec
Signed-off-by: fxiang1 <[email protected]>
1 parent 9018640 commit 2c9554f

File tree

8 files changed

+16
-23
lines changed

8 files changed

+16
-23
lines changed

.github/workflows/go-postsubmit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
# Common versions
11-
GO_VERSION: '1.21'
11+
GO_VERSION: '1.23'
1212
GO_REQUIRED_MIN_VERSION: ''
1313
GOPATH: '/home/runner/work/multicloud-operators-channel/multicloud-operators-channel/go'
1414
defaults:

.github/workflows/go-presubmit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
# Common versions
11-
GO_VERSION: '1.21'
11+
GO_VERSION: '1.23'
1212
GO_REQUIRED_MIN_VERSION: ''
1313
GOPATH: '/home/runner/work/multicloud-operators-channel/multicloud-operators-channel/go'
1414
defaults:

.github/workflows/go-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'v*.*.*'
77
env:
88
# Common versions
9-
GO_VERSION: '1.21'
9+
GO_VERSION: '1.23'
1010
GO_REQUIRED_MIN_VERSION: ''
1111
GOPATH: '/home/runner/work/multicloud-operators-channel/multicloud-operators-channel/go'
1212
GITHUB_REF: ${{ github.ref }}

build/run-code-lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ gem install mdl
3737
gem install awesome_bot
3838

3939
# Install golangci-lint
40-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.57.2
40+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.60.2
4141

4242
# Start lint task
4343
make -f Makefile.prow lint-all

common/config/.golangci.yml

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
service:
22
# When updating this, also update the version stored in docker/build-tools/Dockerfile in the multicloudlab/tools repo.
3-
golangci-lint-version: 1.57.x # use the fixed version to not introduce new linters unexpectedly
3+
golangci-lint-version: 1.60.x # use the fixed version to not introduce new linters unexpectedly
44
run:
55
# timeout for analysis, e.g. 30s, 5m, default is 1m
66
deadline: 20m
@@ -12,16 +12,18 @@ linters:
1212
- bodyclose
1313
- containedctx
1414
- contextcheck
15+
- copyloopvar
1516
- cyclop
16-
- deadcode
1717
- depguard
1818
- dupl
1919
- forbidigo
2020
- funlen
2121
- errchkjson
2222
- exhaustive
2323
- exhaustruct
24-
- exhaustivestruct
24+
- exportloopref
25+
- execinquery
26+
- err113
2527
- forcetypeassert
2628
- gci
2729
- ginkgolinter
@@ -31,44 +33,35 @@ linters:
3133
- gocritic
3234
- gocyclo
3335
- godot
34-
- goerr113
3536
- gofumpt
36-
- golint
3737
- gomnd
3838
- gomoddirectives
3939
- gosec
40-
- ifshort
4140
- ineffassign
4241
- interfacebloat
43-
- interfacer
4442
- ireturn
4543
- loggercheck
4644
- maintidx
47-
- maligned
4845
- musttag
46+
- mnd
4947
- nakedret
5048
- nestif
5149
- nilerr
5250
- nilnil
5351
- nlreturn
5452
- noctx
55-
- nosnakecase
5653
- nonamedreturns
57-
- nosnakecase
5854
- paralleltest
5955
- prealloc
6056
- predeclared
6157
- rowserrcheck
62-
- scopelint
6358
- staticcheck
64-
- structcheck
6559
- sqlclosecheck
6660
- tagliatelle
6761
- tenv
6862
- testpackage
6963
- thelper
7064
- usestdlibvars
71-
- varcheck
7265
- varnamelen
7366
- wastedassign
7467
- wrapcheck

common/scripts/lint_go.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2
17+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.2
1818

1919
export GOLANGCI_LINT_CACHE=/tmp/golangci-cache
2020
rm -rf $GOLANGCI_LINT_CACHE

pkg/log/zap/flags.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (v *levelValue) Set(l string) error {
122122
return err
123123
}
124124

125-
v.level = zapcore.Level(int8(lvl))
125+
v.level = zapcore.Level(int8(lvl)) //nolint:gosec // disable G115
126126
// If log level is greater than debug, set glog/klog level to that level.
127127
if lvl < -3 {
128128
fs := flag.NewFlagSet("", flag.ContinueOnError)
@@ -158,7 +158,7 @@ func (v *stackLevelValue) Set(l string) error {
158158
return err
159159
}
160160

161-
v.level = zapcore.Level(int8(lvl))
161+
v.level = zapcore.Level(int8(lvl)) //nolint:gosec // disable G115
162162

163163
return nil
164164
}

pkg/webhook/wireupwebhook.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func newWebhookServiceTemplate(isExternalAPIServer bool, svcKey types.Namespaced
394394
Spec: corev1.ServiceSpec{
395395
Ports: []corev1.ServicePort{
396396
{
397-
Port: int32(webHookServicePort),
397+
Port: int32(webHookServicePort), //nolint:gosec // disable G115
398398
},
399399
},
400400
},
@@ -413,7 +413,7 @@ func newWebhookServiceTemplate(isExternalAPIServer bool, svcKey types.Namespaced
413413
Spec: corev1.ServiceSpec{
414414
Ports: []corev1.ServicePort{
415415
{
416-
Port: int32(webHookServicePort),
416+
Port: int32(webHookServicePort), //nolint:gosec // disable G115
417417
TargetPort: intstr.FromInt(webHookPort),
418418
},
419419
},
@@ -441,7 +441,7 @@ func newWebhookEndpointTemplate(svcKey types.NamespacedName, webHookServicePort
441441
},
442442
Ports: []corev1.EndpointPort{
443443
{
444-
Port: int32(webHookServicePort),
444+
Port: int32(webHookServicePort), //nolint:gosec // disable G115
445445
},
446446
},
447447
},

0 commit comments

Comments
 (0)