Skip to content

Commit e50c52d

Browse files
committed
feat: support go 1.26
1 parent 09f78d0 commit e50c52d

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
go-version: [ "1.24", "1.25" ]
13+
go-version: [ "1.25", "1.26" ]
1414
runs-on: ubuntu-latest
1515
env:
16-
GOLANGCI_LINT_VERSION: v2.4.0
16+
GOLANGCI_LINT_VERSION: v2.9.0
1717

1818
steps:
1919
- name: Checkout code

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ linters:
4747
max-complexity: 15
4848
funlen:
4949
lines: 160
50+
revive:
51+
rules:
52+
- name: var-naming
53+
arguments:
54+
- []
55+
- []
56+
- - skip-package-name-checks: true
57+
skip-package-name-collision-with-go-std: true
5058
exclusions:
5159
generated: lax
5260
rules:

errors/reason/reason.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ func Extract(err error) ([]string, error) {
3838
//nolint:errorlint // This is the only way to check for the interface.
3939
switch x := err.(type) {
4040
case interface{ Unwrap() []error }:
41-
var (
42-
reasons []string
43-
errs []error
44-
)
41+
reasons := make([]string, 0, len(x.Unwrap()))
42+
var errs []error
4543
for _, err = range x.Unwrap() {
4644
r, e := Extract(err)
4745
reasons = append(reasons, r...)

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/hamba/pkg/v2
22

3-
go 1.24.0
4-
5-
toolchain go1.24.1
3+
go 1.25.0
64

75
require (
86
github.com/hamba/logger/v2 v2.9.0

http/middleware/middleware_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestRecovery(t *testing.T) {
2525

2626
tests := []struct {
2727
name string
28-
val interface{}
28+
val any
2929
wantLog string
3030
}{
3131
{

wait/wait_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ func TestPollUntil(t *testing.T) {
4343
}
4444

4545
func TestPollUntil_HandlesError(t *testing.T) {
46-
ctx, cancel := context.WithCancel(context.Background())
47-
defer cancel()
46+
ctx := t.Context()
4847

4948
var count int
5049
err := wait.PollUntil(ctx, func(context.Context) (done bool, err error) {
@@ -59,8 +58,7 @@ func TestPollUntil_HandlesError(t *testing.T) {
5958
}
6059

6160
func TestPollUntil_HandlesDone(t *testing.T) {
62-
ctx, cancel := context.WithCancel(context.Background())
63-
defer cancel()
61+
ctx := t.Context()
6462

6563
var count int
6664
err := wait.PollUntil(ctx, func(context.Context) (done bool, err error) {
@@ -107,8 +105,7 @@ func TestPollImmediateUntil(t *testing.T) {
107105
}
108106

109107
func TestPollImmediateUntil_HandlesImmediateError(t *testing.T) {
110-
ctx, cancel := context.WithCancel(context.Background())
111-
defer cancel()
108+
ctx := t.Context()
112109

113110
err := wait.PollImmediateUntil(ctx, func(context.Context) (done bool, err error) {
114111
return false, errors.New("test")
@@ -118,8 +115,7 @@ func TestPollImmediateUntil_HandlesImmediateError(t *testing.T) {
118115
}
119116

120117
func TestPollImmediateUntil_HandlesImmediateDone(t *testing.T) {
121-
ctx, cancel := context.WithCancel(context.Background())
122-
defer cancel()
118+
ctx := t.Context()
123119

124120
err := wait.PollImmediateUntil(ctx, func(context.Context) (done bool, err error) {
125121
return true, nil

0 commit comments

Comments
 (0)