Skip to content

Commit 3a0d001

Browse files
committed
Upgrade to go 1.22 and use 1.22 syntax
1 parent 9b9df5f commit 3a0d001

7 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os: [ ubuntu-latest, macos-latest, windows-latest ]
10-
go: [ 1.21.x ]
10+
go: [ 1.22.x ]
1111
runs-on: ${{ matrix.os }}
1212
steps:
1313
- uses: actions/checkout@main

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Build and Test
88
strategy:
99
matrix:
10-
go: [ 1.21.x ]
10+
go: [ 1.22.x ]
1111
runs-on:
1212
- ubuntu-latest
1313
steps:

_examples/demo1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type runner struct {
3838

3939
func (rnr *runner) run(stdout, stderr io.Writer) {
4040
total := 0
41-
for count := 0; count < rnr.howMany; count++ {
41+
for count := range rnr.howMany {
4242
fmt.Fprintf(os.Stderr, "id:%d Write #%d for %d\n", rnr.id, count, len(rnr.line))
4343
n, _ := stdout.Write([]byte(rnr.line))
4444
total += n

_examples/nested.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func recurs(prefix string, depth, widthIndex int, stdout, stderr io.Writer) {
9797

9898
grp, _ := parallel.NewGroup(parallel.OrderRunners(opts.keepOrder),
9999
parallel.WithStdout(stdout), parallel.WithStderr(stderr))
100-
for ix := 0; ix < opts.width; ix++ {
100+
for ix := range opts.width {
101101
ix := ix // Pre 1.22 semantics
102102
grp.Add("", "", func(out, err io.Writer) {
103103
recurs(prefix, depth+1, ix, out, err)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/markdingo/parallel
22

3-
go 1.20
3+
go 1.22

group_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ type testMemoryRunner struct {
266266

267267
func (tqr *testMemoryRunner) run(stdout, stderr io.Writer) {
268268
<-tqr.start
269-
for tqrCount := 0; tqrCount < tqr.howMany; tqrCount++ {
269+
for range tqr.howMany {
270270
n, _ := stdout.Write([]byte(tqr.line))
271271
testTBWritten.Add(int32(n))
272272
}
@@ -320,7 +320,7 @@ func TestGroupLimitMemoryPerRunner(t *testing.T) {
320320
// reaching memory limits.
321321
firstTB := tb
322322
lastTB := tb
323-
for ix := 0; ix < 10; ix++ {
323+
for range 10 {
324324
time.Sleep(time.Millisecond * 100)
325325
tb = int(testTBWritten.Load())
326326
if tb == lastTB {

tagger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (wtr *tagger) Write(p []byte) (n int, err error) {
5454
defer wtr.mu.Unlock()
5555

5656
lines := bytes.Split(p, nl)
57-
for ix := 0; ix < len(lines)-1; ix++ { // Process allbut the last line
57+
for ix := range len(lines) - 1 { // Process allbut the last line
5858
if wtr.tagPending {
5959
_, e := wtr.out.Write(wtr.tag) // W2: Bytes not returned for tag
6060
if e != nil && err == nil { // but first error is always returned

0 commit comments

Comments
 (0)