Bump minimum Go to 1.24, use b.Loop() (#1164)

Go 1.27 is out now so we can bump our minimum Go to 1.24
This commit is contained in:
James Raspass 2026-08-31 09:58:08 +01:00 committed by GitHub
parent 5ac7a8277d
commit 756fcb8d63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 12 deletions

View file

@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
go-version: [1.23.x, 1.24.x, 1.25.x, 1.26.x]
go-version: [1.24.x, 1.25.x, 1.26.x, 1.27.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

2
go.mod
View file

@ -2,4 +2,4 @@ module github.com/go-chi/chi/v5
// Chi supports the four most recent major versions of Go.
// See https://github.com/go-chi/chi/issues/963.
go 1.23
go 1.24

View file

@ -25,7 +25,7 @@ func BenchmarkWalkXFF(b *testing.B) {
b.Run(fmt.Sprintf("n=%d", n), func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
walkXFF(headers, func(entry string) bool {
return false // walk to the leftmost entry
})
@ -48,7 +48,7 @@ func BenchmarkWalkXFF_RightmostStop(b *testing.B) {
b.Run(fmt.Sprintf("n=%d", n), func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
walkXFF(headers, func(entry string) bool {
return true // stop at the rightmost entry
})

View file

@ -321,9 +321,8 @@ func BenchmarkThrottle(b *testing.B) {
req := httptest.NewRequest("GET", "/", nil)
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
w := httptest.NewRecorder()
handler.ServeHTTP(w, req)
}

View file

@ -2153,9 +2153,7 @@ func BenchmarkMux(b *testing.B) {
r, _ := http.NewRequest("GET", path, nil)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
mx.ServeHTTP(w, r)
}
})

View file

@ -503,9 +503,7 @@ func BenchmarkTreeGet(b *testing.B) {
mctx := NewRouteContext()
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
mctx.Reset()
tr.FindRoute(mctx, mGET, "/ping/123/456")
}