Skip to content

Commit 77690ea

Browse files
chore(deps): update Go version
Signed-off-by: anchore-oss-update-bot <anchore-oss-update-bot@users.noreply.github.com>
1 parent 90da471 commit 77690ea

8 files changed

Lines changed: 25 additions & 31 deletions

File tree

collector_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
2727
return "", nil
2828
},
2929
accumulator: func(i int, s string) {},
30-
assert: func(t require.TestingT, err error, i ...interface{}) {
30+
assert: func(t require.TestingT, err error, i ...any) {
3131
require.NoError(t, err)
3232
},
3333
},
@@ -40,7 +40,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
4040
return "", nil
4141
},
4242
accumulator: func(i int, s string) {},
43-
assert: func(t require.TestingT, err error, i ...interface{}) {
43+
assert: func(t require.TestingT, err error, i ...any) {
4444
require.Error(t, err)
4545
p := PanicError{}
4646
if errors.As(err, &p) {
@@ -58,7 +58,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
5858
return "", fmt.Errorf("an error")
5959
},
6060
accumulator: func(i int, s string) {},
61-
assert: func(t require.TestingT, err error, i ...interface{}) {
61+
assert: func(t require.TestingT, err error, i ...any) {
6262
require.Error(t, err)
6363
require.ErrorContains(t, err, "an error")
6464
},
@@ -69,7 +69,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
6969
panic("oh no collector!")
7070
},
7171
accumulator: func(i int, s string) {},
72-
assert: func(t require.TestingT, err error, i ...interface{}) {
72+
assert: func(t require.TestingT, err error, i ...any) {
7373
require.Error(t, err)
7474
require.ErrorContains(t, err, "oh no collector")
7575
// assert the stack trace
@@ -84,7 +84,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
8484
accumulator: func(i int, s string) {
8585
panic("oh no accumulator!")
8686
},
87-
assert: func(t require.TestingT, err error, i ...interface{}) {
87+
assert: func(t require.TestingT, err error, i ...any) {
8888
require.Error(t, err)
8989
require.ErrorContains(t, err, "oh no accumulator")
9090
},
@@ -100,7 +100,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
100100
accumulator: func(i int, s string) {
101101
panic("oh no accumulator!")
102102
},
103-
assert: func(t require.TestingT, err error, i ...interface{}) {
103+
assert: func(t require.TestingT, err error, i ...any) {
104104
require.Error(t, err)
105105
require.ErrorContains(t, err, "oh no collector")
106106
require.ErrorContains(t, err, "oh no accumulator")
@@ -115,7 +115,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
115115
return "", fmt.Errorf("an error")
116116
},
117117
accumulator: func(i int, s string) {},
118-
assert: func(t require.TestingT, err error, i ...interface{}) {
118+
assert: func(t require.TestingT, err error, i ...any) {
119119
require.Error(t, err)
120120
require.ErrorContains(t, err, "an error")
121121
require.ErrorContains(t, err, "oh no collector")
@@ -134,7 +134,7 @@ func Test_CollectHandlesPanics(t *testing.T) {
134134
func Test_CollectCancelRepeat(t *testing.T) {
135135
// iterating these tests many times tends to make problems apparent much more quickly,
136136
// when they may succeed under certain conditions
137-
for i := 0; i < 1000; i++ {
137+
for range 1000 {
138138
Test_CollectCancel(t)
139139
}
140140
}
@@ -189,7 +189,7 @@ func Test_CollectSlice(t *testing.T) {
189189
require.NoError(t, err)
190190

191191
require.Len(t, values, count)
192-
for i := 0; i < count; i++ {
192+
for i := range count {
193193
require.Contains(t, values, i*10)
194194
}
195195

@@ -214,7 +214,7 @@ func Test_CollectMap(t *testing.T) {
214214
require.NoError(t, err)
215215

216216
require.Len(t, values, count)
217-
for i := 0; i < count; i++ {
217+
for i := range count {
218218
require.Equal(t, values[i], i*10)
219219
}
220220

@@ -241,7 +241,7 @@ func Test_Collect2(t *testing.T) {
241241
require.NoError(t, err)
242242

243243
require.Len(t, values, count)
244-
for i := 0; i < count; i++ {
244+
for i := range count {
245245
require.Equal(t, values[i], (i*10)+i)
246246
}
247247

@@ -250,7 +250,7 @@ func Test_Collect2(t *testing.T) {
250250

251251
func countIter(count int) iter.Seq[int] {
252252
return func(yield func(int) bool) {
253-
for i := 0; i < count; i++ {
253+
for i := range count {
254254
if !yield(i) {
255255
return
256256
}

executor_errgroup_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
func Test_errGroupExecutorRepeated(t *testing.T) {
1212
// iterating these tests many times tends to make problems apparent much more quickly,
1313
// when they may succeed under certain conditions
14-
for i := 0; i < 1000; i++ {
14+
for range 1000 {
1515
Test_errGroupExecutor(t)
1616
}
1717
}
@@ -74,7 +74,7 @@ func Test_errGroupExecutor(t *testing.T) {
7474
}
7575

7676
func Test_errGroupExecutorCancelRepeat(t *testing.T) {
77-
for i := 0; i < 100; i++ {
77+
for range 100 {
7878
Test_errGroupExecutorCancel(t)
7979
}
8080
}

executor_queue_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ func Test_queuedExecutor(t *testing.T) {
3535

3636
e := &queuedExecutor{maxConcurrency: concurrency}
3737

38-
for i := 0; i < count; i++ {
38+
for i := range count {
3939
expected = append(expected, i)
4040
e.Go(makeFunc(i))
4141
}
4242

4343
go func() {
44-
for i := 0; i < count; i++ {
44+
for i := range count {
4545
wgs[i].Done()
4646
}
4747
}()
@@ -76,7 +76,7 @@ func Test_queuedExecutorSmall(t *testing.T) {
7676
}
7777

7878
e := &queuedExecutor{maxConcurrency: concurrency}
79-
for i := 0; i < count; i++ {
79+
for i := range count {
8080
e.Go(makeFunc(i))
8181
}
8282

@@ -85,7 +85,7 @@ func Test_queuedExecutorSmall(t *testing.T) {
8585
require.Equal(t, 2, concurrent.Val())
8686

8787
go func() {
88-
for i := 0; i < count; i++ {
88+
for i := range count {
8989
wgs[i].Done()
9090
}
9191
}()
@@ -153,7 +153,7 @@ func Test_explicitExecutorLimiting(t *testing.T) {
153153
func Test_queuedExecutorCancelRepeat(t *testing.T) {
154154
// iterating these tests many times tends to make problems apparent much more quickly,
155155
// when they may succeed under certain conditions
156-
for i := 0; i < 1000; i++ {
156+
for range 1000 {
157157
Test_queuedExecutorCancel(t)
158158
}
159159
}

executor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
func Test_Executors(t *testing.T) {
15-
for i := 0; i < 100; i++ {
15+
for range 100 {
1616
Test_Executor(t)
1717
}
1818
}
@@ -59,7 +59,7 @@ func Test_Executor(t *testing.T) {
5959
executed := atomic.Int32{}
6060
concurrency := stats.Tracked[int]{}
6161

62-
for i := 0; i < count; i++ {
62+
for range count {
6363
e.Go(func() {
6464
defer concurrency.Incr()()
6565
executed.Add(1)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/anchore/go-sync
22

3-
go 1.25.0
3+
go 1.26.2
44

55
require (
66
github.com/stretchr/testify v1.11.1

internal/atomic/float64_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func Test_Float64(t *testing.T) {
1515
concurrency := 3925
1616
num := 3
1717
wg := sync.WaitGroup{}
18-
for i := 0; i < concurrency; i++ {
18+
for range concurrency {
1919
wg.Add(1)
2020
go func() {
2121
val.Add(float64(num))

internal/index/key_split.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,7 @@ func (n *Node[T]) _makeNodeP(unlock *sync.UnlockFunc, name string, nodeIfEmpty *
290290
n._exclusiveLock(unlock)
291291

292292
commonLength := 1 // the first character already matches
293-
minLength := len(key)
294-
if len(name) < minLength {
295-
minLength = len(name)
296-
}
293+
minLength := min(len(name), len(key))
297294
for ; commonLength < minLength; commonLength++ {
298295
if key[commonLength] != name[commonLength] {
299296
break

parallel_writer_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ func Test_ParallelWriter(t *testing.T) {
8282
iterations := 0
8383
for i := 0; i < len(contents); i += test.bufferSize {
8484
iterations++
85-
end := i + test.bufferSize
86-
if end > len(contents) {
87-
end = len(contents)
88-
}
85+
end := min(i+test.bufferSize, len(contents))
8986
buf := contents[i:end]
9087
n, err := w.Write([]byte(buf))
9188
require.NoError(t, err)

0 commit comments

Comments
 (0)