Skip to content

Commit cf758fe

Browse files
authored
ci: Upgrade Go versions, clean up (#1130)
* ci: Upgrade Go versions, clean up * Run go fix * Upgrade goreleaser * Remove rand.Seed * Goreleaser broken again.
1 parent 77cc520 commit cf758fe

31 files changed

Lines changed: 34 additions & 92 deletions

.github/workflows/go.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
strategy:
1414
matrix:
15-
go-version: [1.23.x, 1.24.x, 1.25.x]
15+
go-version: [1.24.x, 1.25.x, 1.26.x]
1616
os: [ubuntu-latest, macos-latest, windows-latest]
1717
env:
1818
CGO_ENABLED: 0
@@ -60,7 +60,7 @@ jobs:
6060
- name: Set up Go
6161
uses: actions/setup-go@v6.2.0
6262
with:
63-
go-version: 1.25.x
63+
go-version: 1.26.x
6464

6565
- name: Checkout code
6666
uses: actions/checkout@v6.0.2
@@ -82,7 +82,7 @@ jobs:
8282
- name: Set up Go
8383
uses: actions/setup-go@v6.2.0
8484
with:
85-
go-version: 1.25.x
85+
go-version: 1.26.x
8686

8787
- name: Checkout code
8888
uses: actions/checkout@v6.0.2
@@ -97,10 +97,10 @@ jobs:
9797
run: go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d&&./s2c -verify s2c &&./s2d s2c.s2&&rm ./s2c&&rm s2d&&rm s2c.s2
9898

9999
- name: goreleaser deprecation
100-
run: curl -sfL https://git.io/goreleaser | VERSION=v2.3.2 sh -s -- check
100+
run: curl -sfL https://goreleaser.com/static/run | VERSION=v2.13.3 bash -s -- check
101101

102102
- name: goreleaser snapshot
103-
run: curl -sL https://git.io/goreleaser | VERSION=v2.3.2 sh -s -- --snapshot --clean
103+
run: curl -sfL https://goreleaser.com/static/run | VERSION=v2.13.3 bash -s -- --snapshot --clean
104104

105105
- name: Test S2 GOAMD64 v3
106106
env:
@@ -125,7 +125,7 @@ jobs:
125125
- name: Set up Go
126126
uses: actions/setup-go@v6.2.0
127127
with:
128-
go-version: 1.25.x
128+
go-version: 1.26.x
129129

130130
- name: Checkout code
131131
uses: actions/checkout@v6.0.2

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
name: Set up Go
2222
uses: actions/setup-go@a5f9b05d2d216f63e13859e0d847461041025775 # v5.2.0
2323
with:
24-
go-version: 1.25.x
24+
go-version: 1.26.x
2525
-
2626
name: Run GoReleaser
2727
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
2828
with:
29-
version: 2.11.2
29+
version: 2.13.3
3030
args: release --clean
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ builds:
3131
- mips64le
3232
goarm:
3333
- 7
34+
ignore:
35+
- goos: windows
36+
goarch: arm
3437
-
3538
id: "s2d"
3639
binary: s2d
@@ -57,6 +60,9 @@ builds:
5760
- mips64le
5861
goarm:
5962
- 7
63+
ignore:
64+
- goos: windows
65+
goarch: arm
6066
-
6167
id: "s2sx"
6268
binary: s2sx
@@ -84,14 +90,17 @@ builds:
8490
- mips64le
8591
goarm:
8692
- 7
93+
ignore:
94+
- goos: windows
95+
goarch: arm
8796

8897
archives:
8998
-
9099
id: s2-binaries
91100
name_template: "s2-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
92101
format_overrides:
93102
- goos: windows
94-
format: zip
103+
formats: ['zip']
95104
files:
96105
- unpack/*
97106
- s2/LICENSE

flate/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func Example_synchronization() {
177177
}
178178

179179
b := make([]byte, 256)
180-
for _, m := range strings.Fields("A long time ago in a galaxy far, far away...") {
180+
for m := range strings.FieldsSeq("A long time ago in a galaxy far, far away...") {
181181
// We use a simple framing format where the first byte is the
182182
// message length, followed the message itself.
183183
b[0] = uint8(copy(b[1:], m))

flate/regmask_other.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !amd64
2-
// +build !amd64
32

43
package flate
54

flate/writer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ func TestWriter_Reset(t *testing.T) {
335335
}
336336
in := buf.Bytes()
337337
for l := range 10 {
338-
l := l
339338
if testing.Short() && l > 1 {
340339
continue
341340
}

go.mod

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

3-
go 1.23
3+
go 1.24
44

55
retract (
66
// https://github.com/klauspost/compress/issues/1114

gzhttp/asserts_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package gzhttp
66

77
import (
88
"reflect"
9+
"slices"
910
"testing"
1011
)
1112

@@ -51,7 +52,7 @@ func isNil(object any) bool {
5152
[]reflect.Kind{
5253
reflect.Chan, reflect.Func,
5354
reflect.Interface, reflect.Map,
54-
reflect.Ptr, reflect.Slice},
55+
reflect.Pointer, reflect.Slice},
5556
kind)
5657

5758
if isNilableKind && value.IsNil() {
@@ -63,11 +64,5 @@ func isNil(object any) bool {
6364

6465
// containsKind checks if a specified kind in the slice of kinds.
6566
func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool {
66-
for i := range kinds {
67-
if kind == kinds[i] {
68-
return true
69-
}
70-
}
71-
72-
return false
67+
return slices.Contains(kinds, kind)
7368
}

gzip/gzip_test.go

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ func testFileWindow(i, window int, t *testing.T) {
361361
}
362362

363363
func testBigGzip(i int, t *testing.T) {
364+
rng := rand.New(rand.NewSource(1337))
364365
if len(testbuf) != i {
365366
// Make results predictable
366-
rand.Seed(1337)
367367
testbuf = make([]byte, i)
368368
for idx := range testbuf {
369-
testbuf[idx] = byte(65 + rand.Intn(20))
369+
testbuf[idx] = byte(65 + rng.Intn(20))
370370
}
371371
}
372372
c := BestCompression
@@ -441,10 +441,10 @@ func testDeterm(level int, t *testing.T) {
441441
if testing.Short() {
442442
length = 100000
443443
}
444-
rand.Seed(1337)
444+
rng := rand.New(rand.NewSource(1337))
445445
t1 := make([]byte, length)
446446
for idx := range t1 {
447-
t1[idx] = byte(65 + rand.Intn(8))
447+
t1[idx] = byte(65 + rng.Intn(8))
448448
}
449449

450450
br := bytes.NewBuffer(t1)
@@ -462,10 +462,10 @@ func testDeterm(level int, t *testing.T) {
462462

463463
// We recreate the buffer, so we have a goos chance of getting a
464464
// different memory address.
465-
rand.Seed(1337)
465+
rng = rand.New(rand.NewSource(1337))
466466
t2 := make([]byte, length)
467467
for idx := range t2 {
468-
t2[idx] = byte(65 + rand.Intn(8))
468+
t2[idx] = byte(65 + rng.Intn(8))
469469
}
470470

471471
br2 := bytes.NewBuffer(t2)
@@ -538,46 +538,6 @@ func benchmarkGzipN(b *testing.B, level int) {
538538
}
539539
}
540540

541-
/*
542-
func BenchmarkOldGzipL1(b *testing.B) { benchmarkOldGzipN(b, 1) }
543-
func BenchmarkOldGzipL2(b *testing.B) { benchmarkOldGzipN(b, 2) }
544-
func BenchmarkOldGzipL3(b *testing.B) { benchmarkOldGzipN(b, 3) }
545-
func BenchmarkOldGzipL4(b *testing.B) { benchmarkOldGzipN(b, 4) }
546-
func BenchmarkOldGzipL5(b *testing.B) { benchmarkOldGzipN(b, 5) }
547-
func BenchmarkOldGzipL6(b *testing.B) { benchmarkOldGzipN(b, 6) }
548-
func BenchmarkOldGzipL7(b *testing.B) { benchmarkOldGzipN(b, 7) }
549-
func BenchmarkOldGzipL8(b *testing.B) { benchmarkOldGzipN(b, 8) }
550-
func BenchmarkOldGzipL9(b *testing.B) { benchmarkOldGzipN(b, 9) }
551-
552-
func benchmarkOldGzipN(b *testing.B, level int) {
553-
dat, _ := os.ReadFile("testdata/test.json")
554-
dat = append(dat, dat...)
555-
dat = append(dat, dat...)
556-
dat = append(dat, dat...)
557-
dat = append(dat, dat...)
558-
dat = append(dat, dat...)
559-
560-
b.SetBytes(int64(len(dat)))
561-
w, _ := oldgz.NewWriterLevel(io.Discard, level)
562-
b.ResetTimer()
563-
for n := 0; n < b.N; n++ {
564-
w.Reset(io.Discard)
565-
n, err := w.Write(dat)
566-
if n != len(dat) {
567-
panic("short write")
568-
}
569-
if err != nil {
570-
panic(err)
571-
}
572-
err = w.Close()
573-
if err != nil {
574-
panic(err)
575-
}
576-
}
577-
}
578-
579-
*/
580-
581541
func BenchmarkCompressAllocations(b *testing.B) {
582542
payload := []byte(strings.Repeat("Tiny payload", 20))
583543
for j := -2; j <= 9; j++ {

huff0/_generate/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/klauspost/compress/huff0/_generate
22

3-
go 1.23
3+
go 1.24
44

55
toolchain go1.24.2
66

0 commit comments

Comments
 (0)