Skip to content

Commit 1ce56ca

Browse files
authored
update golangci version to 1.60.x (#1076)
* update golangci version to 1.60.x Signed-off-by: Daniel Fan <[email protected]> * fix lint issues Signed-off-by: Daniel Fan <[email protected]> * Bump golang verison in Dockerfile Signed-off-by: Daniel Fan <[email protected]> * fix lint issue Signed-off-by: Daniel Fan <[email protected]> --------- Signed-off-by: Daniel Fan <[email protected]>
1 parent 1ec4497 commit 1ce56ca

File tree

7 files changed

+46
-22
lines changed

7 files changed

+46
-22
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM docker.io/golang:1.22.5-bullseye as builder
2+
FROM docker.io/golang:1.23.0-bullseye as builder
33
ARG GOARCH
44

55
WORKDIR /workspace

common/config/.golangci.yml

Lines changed: 30 additions & 12 deletions
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.51.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
@@ -10,43 +10,44 @@ run:
1010
# default value is empty list, but next dirs are always skipped independently
1111
# from this option's value:
1212
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
13-
skip-dirs:
14-
- genfiles$
15-
- vendor$
13+
# skip-dirs:
14+
# - genfiles$
15+
# - vendor$
1616

1717
# which files to skip: they will be analyzed, but issues from them
1818
# won't be reported. Default value is empty list, but there is
1919
# no need to include all autogenerated files, we confidently recognize
2020
# autogenerated files. If it's not please let us know.
21-
skip-files:
22-
- ".*\\.pb\\.go"
23-
- ".*\\.gen\\.go"
21+
# skip-files:
22+
# - ".*\\.pb\\.go"
23+
# - ".*\\.gen\\.go"
2424

2525
linters:
2626
# please, do not use `enable-all`: it's deprecated and will be removed soon.
2727
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
2828
disable-all: true
2929
enable:
30-
- deadcode
30+
# - deadcode
3131
- errcheck
3232
# - gocyclo
3333
- gofmt
3434
- goimports
35-
- golint
35+
# - golint
36+
- revive
3637
- gosec
3738
- gosimple
3839
- govet
3940
- ineffassign
40-
- interfacer
41+
# - interfacer
4142
- lll
4243
- misspell
4344
- staticcheck
44-
- structcheck
45+
# - structcheck
4546
- typecheck
4647
- unconvert
4748
- unparam
4849
- unused
49-
- varcheck
50+
# - varcheck
5051
# don't enable:
5152
# - gocritic
5253
# - bodyclose
@@ -185,6 +186,15 @@ linters-settings:
185186
# - unnamedResult
186187
# - wrapperFunc
187188

189+
revive:
190+
rules:
191+
- name: dot-imports
192+
arguments:
193+
- allowedPackages:
194+
- "github.com/onsi/ginkgo"
195+
- "github.com/onsi/ginkgo/v2"
196+
- "github.com/onsi/gomega"
197+
188198
issues:
189199
# List of regexps of issue texts to exclude, empty list by default.
190200
# But independently from this option we use default exclude patterns,
@@ -199,6 +209,14 @@ issues:
199209
linters:
200210
- errcheck
201211
- maligned
212+
213+
exclude-dirs:
214+
- genfiles$
215+
- vendor$
216+
217+
exclude-files:
218+
- ".*\\.pb\\.go"
219+
- ".*\\.gen\\.go"
202220

203221
# Independently from option `exclude` we use default exclude patterns,
204222
# it can be disabled by this option. To list all

common/scripts/lint_go.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# limitations under the License.
1616
#
1717

18-
GOGC=25 golangci-lint run -c ./common/config/.golangci.yml
18+
GOGC=25 golangci-lint run -c ./common/config/.golangci.yml --timeout=180s

controllers/operandregistry/operandregistry_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
7878
}
7979

8080
// Summarize instance status
81-
if instance.Status.OperatorsStatus == nil || len(instance.Status.OperatorsStatus) == 0 {
81+
if len(instance.Status.OperatorsStatus) == 0 {
8282
instance.UpdateRegistryPhase(operatorv1alpha1.RegistryReady)
8383
} else {
8484
instance.UpdateRegistryPhase(operatorv1alpha1.RegistryRunning)

controllers/operandrequest/reconcile_operand.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ func (r *Reconciler) reconcileCRwithRequest(ctx context.Context, requestInstance
371371
var crFromRequest unstructured.Unstructured
372372

373373
if operand.APIVersion == "" {
374-
return fmt.Errorf("The APIVersion of operand is empty for operator " + operand.Name)
374+
return fmt.Errorf("the APIVersion of operand is empty for operator %s", operand.Name)
375375
}
376376

377377
if operand.Kind == "" {
378-
return fmt.Errorf("The Kind of operand is empty for operator " + operand.Name)
378+
return fmt.Errorf("the Kind of operand is empty for operator %s", operand.Name)
379379
}
380380

381381
var name string
@@ -509,14 +509,14 @@ func (r *Reconciler) reconcileK8sResourceWithRetries(ctx context.Context, res op
509509

510510
func (r *Reconciler) reconcileK8sResource(ctx context.Context, res operatorv1alpha1.ConfigResource, serviceName, opConfigName, opConfigNs string) error {
511511
if res.APIVersion == "" {
512-
return fmt.Errorf("The APIVersion of k8s resource is empty for operator " + serviceName)
512+
return fmt.Errorf("the APIVersion of k8s resource is empty for operator %s", serviceName)
513513
}
514514

515515
if res.Kind == "" {
516-
return fmt.Errorf("The Kind of k8s resource is empty for operator " + serviceName)
516+
return fmt.Errorf("the Kind of k8s resource is empty for operator %s", serviceName)
517517
}
518518
if res.Name == "" {
519-
return fmt.Errorf("The Name of k8s resource is empty for operator " + serviceName)
519+
return fmt.Errorf("the Name of k8s resource is empty for operator %s", serviceName)
520520
}
521521
var k8sResNs string
522522
if res.Namespace == "" {

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/IBM/operand-deployment-lifecycle-manager/v4
22

3-
go 1.20
3+
go 1.23
44

55
require (
66
github.com/IBM/controller-filtered-cache v0.3.5
@@ -112,4 +112,3 @@ require (
112112

113113
// fix vulnerability: CVE-2021-3121 in github.com/gogo/protobuf v1.2.1
114114
replace github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
115-

go.sum

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM
309309
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
310310
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
311311
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
312+
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
312313
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
313314
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
314315
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
@@ -624,6 +625,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
624625
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
625626
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
626627
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
628+
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
627629
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
628630
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
629631
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -859,6 +861,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
859861
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
860862
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
861863
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
864+
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
862865
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
863866
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
864867
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -902,6 +905,7 @@ github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJ
902905
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
903906
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
904907
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
908+
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
905909
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
906910
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
907911
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
@@ -1007,6 +1011,7 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
10071011
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
10081012
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
10091013
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
1014+
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
10101015
go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc=
10111016
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E=
10121017
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4=
@@ -1027,6 +1032,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
10271032
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
10281033
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
10291034
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
1035+
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
10301036
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
10311037
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
10321038
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
@@ -1197,6 +1203,7 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
11971203
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
11981204
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
11991205
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
1206+
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
12001207
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12011208
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12021209
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

0 commit comments

Comments
 (0)