build: address 'intrange' linter warning

golangci-lint warns about this:

    for loop can be changed to use an integer range (Go 1.22+)
    (intrange)

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2024-04-26 10:49:26 +02:00
committed by mergify[bot]
parent 0e7b06e9d0
commit e85914fc0d
10 changed files with 46 additions and 46 deletions

View File

@ -528,7 +528,7 @@ var _ = Describe("nfs", func() {
}
app.Namespace = f.UniqueName
// create PVC and app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
err = createPVCAndApp(name, f, pvc, app, deployTimeout)
if err != nil {
@ -542,7 +542,7 @@ var _ = Describe("nfs", func() {
validateSubvolumeCount(f, totalCount, fileSystemName, defaultSubvolumegroup)
// delete PVC and app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
err = deletePVCAndApp(name, f, pvc, app)
if err != nil {
@ -699,7 +699,7 @@ var _ = Describe("nfs", func() {
snap.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
// create snapshot
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, s snapapi.VolumeSnapshot) {
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createSnapshot(&s, deployTimeout)
@ -736,7 +736,7 @@ var _ = Describe("nfs", func() {
// create multiple PVC from same snapshot
wg.Add(totalCount)
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
@ -790,7 +790,7 @@ var _ = Describe("nfs", func() {
wg.Add(totalCount)
// delete clone and app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name
@ -817,7 +817,7 @@ var _ = Describe("nfs", func() {
validateOmapCount(f, totalCount, cephfsType, metadataPool, snapsType)
// create clones from different snapshots and bind it to an app
wg.Add(totalCount)
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name
@ -872,7 +872,7 @@ var _ = Describe("nfs", func() {
wg.Add(totalCount)
// delete snapshot
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, s snapapi.VolumeSnapshot) {
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = deleteSnapshot(&s, deployTimeout)
@ -896,7 +896,7 @@ var _ = Describe("nfs", func() {
wg.Add(totalCount)
// delete clone and app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name
@ -980,7 +980,7 @@ var _ = Describe("nfs", func() {
appClone.Labels = label
wg.Add(totalCount)
// create clone and bind it to an app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
@ -1036,7 +1036,7 @@ var _ = Describe("nfs", func() {
wg.Add(totalCount)
// delete clone and app
for i := 0; i < totalCount; i++ {
for i := range totalCount {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name