From c1e4fdd5b53f41d7ada1018d023f14f51bdcf60a Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sat, 16 May 2026 11:08:08 +0900 Subject: [PATCH] Update to go1.25 as minimal version (#2205) --- .github/workflows/test.yml | 20 ++++++------- README.md | 2 +- client_test.go | 60 +++++++++++++------------------------- go.mod | 12 ++++---- go.sum | 16 +++++----- 5 files changed, 44 insertions(+), 66 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b38b785..cc230c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,22 +2,22 @@ name: Test on: push: branches: - - master + - master pull_request: jobs: test: strategy: fail-fast: false matrix: - go-version: [1.24.x, 1.26.x] - os: [ubuntu-latest, macos-latest, windows-latest, macos-14] + go-version: [ 1.25.x, 1.26.x ] + os: [ ubuntu-latest, macos-latest, windows-latest, macos-latest ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version: ${{ matrix.go-version }} - - run: go version - - run: go test -shuffle=on ./... - - run: go test -race -shuffle=on ./... + - run: go version + - run: go test -shuffle=on ./... + - run: go test -race -shuffle=on ./... diff --git a/README.md b/README.md index 3ed0511..52814ef 100644 --- a/README.md +++ b/README.md @@ -665,7 +665,7 @@ This is an **unsafe** way, the result string and `[]byte` buffer share the same - _Which GO versions are supported by fasthttp?_ We support the same versions the Go team supports. - Currently that is Go 1.24.x and newer. + Currently that is Go 1.25.x and newer. Older versions might work, but won't officially be supported. - _Please provide real benchmark data and server information_ diff --git a/client_test.go b/client_test.go index efd73f8..844c46c 100644 --- a/client_test.go +++ b/client_test.go @@ -1493,9 +1493,7 @@ func TestHostClientMaxConnsWithDeadline(t *testing.T) { } for range 5 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { req := AcquireRequest() req.SetRequestURI("http://foobar/baz") req.Header.SetMethod(MethodPost) @@ -1522,7 +1520,7 @@ func TestHostClientMaxConnsWithDeadline(t *testing.T) { if string(body) != "foo" { t.Errorf("unexpected body %q. Expecting %q", body, "abcd") } - }() + }) } wg.Wait() @@ -1920,11 +1918,9 @@ func TestClientGetTimeoutSuccessConcurrent(t *testing.T) { var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testClientGetTimeoutSuccess(t, &defaultClient, "http://"+s.Addr(), 100) - }() + }) } wg.Wait() } @@ -1947,12 +1943,10 @@ func TestClientDoTimeoutSuccessConcurrent(t *testing.T) { var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testClientDoTimeoutSuccess(t, &defaultClient, "http://"+s.Addr(), 100) testClientRequestSetTimeoutSuccess(t, &defaultClient, "http://"+s.Addr(), 100) - }() + }) } wg.Wait() } @@ -1989,11 +1983,9 @@ func TestClientGetTimeoutErrorConcurrent(t *testing.T) { var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testClientGetTimeoutError(t, c, 100) - }() + }) } wg.Wait() } @@ -2031,11 +2023,9 @@ func TestClientDoTimeoutErrorConcurrent(t *testing.T) { var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testClientDoTimeoutError(t, c, 100) - }() + }) } wg.Wait() } @@ -2618,12 +2608,10 @@ func TestClientConcurrent(t *testing.T) { addr := "http://" + s.Addr() var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testClientGet(t, &defaultClient, addr, 30) testClientPost(t, &defaultClient, addr, 10) - }() + }) } wg.Wait() } @@ -2673,12 +2661,10 @@ func TestHostClientConcurrent(t *testing.T) { var wg sync.WaitGroup for range 10 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { testHostClientGet(t, c, 30) testHostClientPost(t, c, 10) - }() + }) } wg.Wait() } @@ -3005,9 +2991,7 @@ func TestHostClientMaxConnWaitTimeoutSuccess(t *testing.T) { } for range 5 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { req := AcquireRequest() req.SetRequestURI("http://foobar/baz") req.Header.SetMethod(MethodPost) @@ -3026,7 +3010,7 @@ func TestHostClientMaxConnWaitTimeoutSuccess(t *testing.T) { if string(body) != "foo" { t.Errorf("unexpected body %q. Expecting %q", body, "abcd") } - }() + }) } wg.Wait() @@ -3082,9 +3066,7 @@ func TestHostClientMaxConnWaitTimeoutError(t *testing.T) { var errNoFreeConnsCount atomic.Uint32 for range 5 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { req := AcquireRequest() req.SetRequestURI("http://foobar/baz") req.Header.SetMethod(MethodPost) @@ -3106,7 +3088,7 @@ func TestHostClientMaxConnWaitTimeoutError(t *testing.T) { t.Errorf("unexpected body %q. Expecting %q", body, "abcd") } } - }() + }) } wg.Wait() @@ -3178,9 +3160,7 @@ func TestHostClientMaxConnWaitTimeoutWithEarlierDeadline(t *testing.T) { var errTimeoutCount atomic.Uint32 for range 5 { - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { req := AcquireRequest() req.SetRequestURI("http://foobar/baz") req.Header.SetMethod(MethodPost) @@ -3202,7 +3182,7 @@ func TestHostClientMaxConnWaitTimeoutWithEarlierDeadline(t *testing.T) { t.Errorf("unexpected body %q. Expecting %q", body, "abcd") } } - }() + }) } wg.Wait() diff --git a/go.mod b/go.mod index e186f48..6d902e5 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,14 @@ module github.com/valyala/fasthttp -go 1.24.0 - -toolchain go1.24.1 +go 1.25.0 require ( github.com/andybalholm/brotli v1.2.1 github.com/klauspost/compress v1.18.6 github.com/valyala/bytebufferpool v1.0.0 - golang.org/x/crypto v0.48.0 - golang.org/x/net v0.50.0 - golang.org/x/sys v0.41.0 + golang.org/x/crypto v0.51.0 + golang.org/x/net v0.54.0 + golang.org/x/sys v0.44.0 ) -require golang.org/x/text v0.34.0 // indirect +require golang.org/x/text v0.37.0 // indirect diff --git a/go.sum b/go.sum index a52fa75..f07fc58 100644 --- a/go.sum +++ b/go.sum @@ -6,11 +6,11 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= -golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= -golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= -golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60= -golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI= +golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8= +golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w= +golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ= +golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= +golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=