From 0ae2dbc848ac007265bbb6aeb1a6a7a3e495975d Mon Sep 17 00:00:00 2001 From: Julien Schmidt Date: Fri, 28 Aug 2026 17:39:35 +0200 Subject: [PATCH] chore: bump min Go version to 1.25 and start testing with v1.27 --- .github/workflows/ci.yaml | 4 ++-- base32/base32.go | 2 -- base32/base32_test.go | 8 ++++---- encoding_test.go | 4 ++-- go.mod | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d054e74..67306f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: - main env: - GOLANGCI_LINT_VERSION: v2.9.0 + GOLANGCI_LINT_VERSION: v2.13.2 permissions: contents: read @@ -19,7 +19,7 @@ jobs: name: Test strategy: matrix: - version: ["1.24", "1.25", "1.26"] + version: ["1.25", "1.26", "1.27"] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/base32/base32.go b/base32/base32.go index ce2a115..e8b74ea 100644 --- a/base32/base32.go +++ b/base32/base32.go @@ -167,8 +167,6 @@ func DecodeLower(s string) ([]byte, error) { // ensure the table is valid. // // Direct usage is discouraged. Use DecodeUpper or DecodeLower instead. -// -//nolint:gosec // G602 false positive: s length is validated and all indexes are fixed in this unrolled decoder. func Decode(s string, idxTable [256]byte) ([]byte, error) { if len(s) != 26 { return nil, ErrInvalidLength diff --git a/base32/base32_test.go b/base32/base32_test.go index a28a187..19fc860 100644 --- a/base32/base32_test.go +++ b/base32/base32_test.go @@ -33,7 +33,7 @@ func TestEncodeDecode(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() - for i := 0; i < 1000; i++ { + for range 1000 { // Generate 16 random bytes data := make([]byte, 16) _, err := rand.Read(data) @@ -61,7 +61,7 @@ func TestEncodeDecode(t *testing.T) { if err != nil { t.Errorf("unexpected error during decode:\n%+v", err) } - for i := 0; i < 16; i++ { + for i := range 16 { if data[i] != decoded[i] { t.Errorf("decoded value is not equal to original:\nExpected: %v\nActual: %v", data[i], decoded[i]) } @@ -72,7 +72,7 @@ func TestEncodeDecode(t *testing.T) { encoder := base32.NewEncoding("0123456789ABCDEFGHJKMNPQRSTVWXYZ") - for i := 0; i < 1000; i++ { + for range 1000 { // Generate 16 random bytes data := make([]byte, 16) _, err := rand.Read(data) @@ -100,7 +100,7 @@ func TestEncodeDecode(t *testing.T) { if err != nil { t.Errorf("unexpected error during decode:\n%+v", err) } - for i := 0; i < 16; i++ { + for i := range 16 { if data[i] != decoded[i] { t.Errorf("decoded value is not equal to original:\nExpected: %v\nActual: %v", data[i], decoded[i]) } diff --git a/encoding_test.go b/encoding_test.go index 0bff8b0..bd1ca7e 100644 --- a/encoding_test.go +++ b/encoding_test.go @@ -133,8 +133,8 @@ func TestTypeID_SQL_Scan(t *testing.T) { t.Fatalf("create UserID: unexpected error:\n%+v", err) } - scannerType := reflect.TypeOf((*sql.Scanner)(nil)).Elem() - if !reflect.TypeOf(&UserID{}).Implements(scannerType) { + scannerType := reflect.TypeFor[sql.Scanner]() + if !reflect.TypeFor[*UserID]().Implements(scannerType) { t.Fatalf("typeid.TypeID instantiation implements the `sql.Scanner` interface") } diff --git a/go.mod b/go.mod index 425219f..c22fde7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/sumup/typeid -go 1.24.0 +go 1.25.0 require ( github.com/gofrs/uuid/v5 v5.4.0