Skip to content

Commit 4a911fd

Browse files
committed
Modernize remaining symbols
1 parent 1f65014 commit 4a911fd

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

pkg/common-controller/snapshot_controller_base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func (ctrl *csiSnapshotCommonController) Run(workers int, stopCh <-chan struct{}
279279
ctrl.initializeCaches()
280280

281281
if utilfeature.DefaultFeatureGate.Enabled(features.ReleaseLeaderElectionOnExit) {
282-
for i := 0; i < workers; i++ {
282+
for range workers {
283283
wg.Add(1)
284284
go func() {
285285
defer wg.Done()
@@ -305,7 +305,7 @@ func (ctrl *csiSnapshotCommonController) Run(workers int, stopCh <-chan struct{}
305305
}
306306
}
307307
} else {
308-
for i := 0; i < workers; i++ {
308+
for range workers {
309309
go wait.Until(ctrl.snapshotWorker, 0, stopCh)
310310
go wait.Until(ctrl.contentWorker, 0, stopCh)
311311
if ctrl.enableVolumeGroupSnapshots {

pkg/sidecar-controller/snapshot_controller_base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (ctrl *csiSnapshotSideCarController) Run(workers int, stopCh <-chan struct{
188188
ctrl.initializeCaches()
189189

190190
if utilfeature.DefaultFeatureGate.Enabled(features.ReleaseLeaderElectionOnExit) {
191-
for i := 0; i < workers; i++ {
191+
for range workers {
192192
wg.Add(1)
193193
go func() {
194194
defer wg.Done()
@@ -203,7 +203,7 @@ func (ctrl *csiSnapshotSideCarController) Run(workers int, stopCh <-chan struct{
203203
}
204204
}
205205
} else {
206-
for i := 0; i < workers; i++ {
206+
for range workers {
207207
go wait.Until(ctrl.contentWorker, 0, stopCh)
208208
if ctrl.enableVolumeGroupSnapshots {
209209
go wait.Until(ctrl.groupSnapshotContentWorker, 0, stopCh)

pkg/webhook/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func convertVolumeGroupSnapshotContentFromV1beta2ToV1beta1(obj *unstructured.Uns
135135

136136
// Step 2: convert volumeSnapshotInfoList to volumeSnapshotHandlePairList
137137
for i, entry := range volumeSnapshotInfoList {
138-
if mapEntry, ok := entry.(map[string]interface{}); ok {
138+
if mapEntry, ok := entry.(map[string]any); ok {
139139
delete(mapEntry, "creationTime")
140140
delete(mapEntry, "readyToUse")
141141
delete(mapEntry, "restoreSize")

pkg/webhook/framework.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
// template that can be used for any CR conversion given this function.
4343
type convertFunc func(Object *unstructured.Unstructured, version string) (*unstructured.Unstructured, metav1.Status)
4444

45-
func statusErrorWithMessage(msg string, params ...interface{}) metav1.Status {
45+
func statusErrorWithMessage(msg string, params ...any) metav1.Status {
4646
return metav1.Status{
4747
Message: fmt.Sprintf(msg, params...),
4848
Status: metav1.StatusFailure,

pkg/webhook/webhook_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package webhook
1818

1919
import (
20-
"context"
2120
"crypto/rand"
2221
"crypto/rsa"
2322
"crypto/tls"
@@ -55,8 +54,7 @@ func TestWebhookCertReload(t *testing.T) {
5554
}
5655

5756
// Start test server
58-
ctx, cancel := context.WithCancel(context.Background())
59-
defer cancel()
57+
ctx := t.Context()
6058
cw, err := NewCertWatcher(certFile, keyFile)
6159
if err != nil {
6260
t.Errorf("failed to initialize new cert watcher: %v", err)
@@ -97,7 +95,7 @@ func TestWebhookCertReload(t *testing.T) {
9795
}
9896

9997
// TC: Certificate should consistently change with a file change
100-
for i := 0; i < 5; i++ {
98+
for range 5 {
10199
// Generate new key/cert
102100
err = generateTestCertKeyPair(t, certFile, keyFile)
103101
if err != nil {
@@ -134,7 +132,7 @@ func generateTestCertKeyPair(t *testing.T, certPath, keyPath string) error {
134132
return fmt.Errorf("Failed to generate serial number: %v", err)
135133
}
136134

137-
var priv interface{}
135+
var priv any
138136
priv, err = rsa.GenerateKey(rand.Reader, 4096)
139137
if err != nil {
140138
return fmt.Errorf("Failed to generate key: %v", err)

release-tools/verify-go-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ "$majorminor" != "$expected" ]; then
3939
======================================================
4040
WARNING
4141
42-
This projects is tested with Go v$expected.
42+
This project is tested with Go v$expected.
4343
Your current Go version is v$majorminor.
4444
This may or may not be close enough.
4545

0 commit comments

Comments
 (0)