diff --git a/.github/README.md b/.github/README.md index 9a0796f758..5eb43b0301 100644 --- a/.github/README.md +++ b/.github/README.md @@ -136,7 +136,7 @@ These tests are performed by [TechEmpower](https://www.techempower.com/benchmark ## ⚙️ Installation -Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.20` or higher is required. +Make sure you have Go installed ([download](https://go.dev/dl/)). Version `1.21` or higher is required. Initialize your project by creating a folder and then running `go mod init github.com/your/repo` ([learn more](https://go.dev/blog/using-go-modules)) inside the folder. Then install Fiber with the [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command: @@ -170,7 +170,7 @@ We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues), ## ⚠️ Limitations -- Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 3.0.0 has been tested with Go versions 1.20 to 1.22. +- Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 3.0.0 has been tested with Go versions 1.21 and 1.22. - Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem. ## 👀 Examples @@ -651,10 +651,9 @@ List of externally hosted middleware modules and maintained by the [Fiber team]( | Middleware | Description | | :------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- | -| [jwt](https://github.com/gofiber/jwt) | JWT returns a JSON Web Token \(JWT\) auth middleware. | +| [contrib](https://github.com/gofiber/contrib) | Third party middlewares | | [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. | -| [template](https://github.com/gofiber/template) | This package contains 8 template engines that can be used with Fiber `v1.10.x` Go version 1.13 or higher is required. | -| [websocket](https://github.com/gofiber/websocket) | Based on Fasthttp WebSocket for Fiber with Locals support! | +| [template](https://github.com/gofiber/template) | This package contains 9 template engines that can be used with Fiber `v3` Go version 1.21 or higher is required. | ## 🕶️ Awesome List diff --git a/.github/README_az.md b/.github/README_az.md index 9da38acd42..5941ba1680 100644 --- a/.github/README_az.md +++ b/.github/README_az.md @@ -164,7 +164,7 @@ Biz istifadəçilərdən gələn [issue-a](https://github.com/gofiber/fiber/issu ## ⚠️ Limitlər -- Fiber unsafe prinsiplərə əsaslanaraq çalışdığından, o hər zaman Go-nun son versiyası ilə uyğunlaşmaya bilər. Buna görə də, Fiber 3.0.0 — Go 1.20 və 1.22 versiyaları ilə test edilərək saz vəziyyətə gətirilmişdir. +- Fiber unsafe prinsiplərə əsaslanaraq çalışdığından, o hər zaman Go-nun son versiyası ilə uyğunlaşmaya bilər. Buna görə də, Fiber 3.0.0 — Go 1.21 və 1.22 versiyaları ilə test edilərək saz vəziyyətə gətirilmişdir. - Fiber net/http interfeysləri ilə uyğun deyil. Yəni gqlgen, go-swagger kimi net/http ekosisteminin parçası olan layihələri istifadə edə bilməzsiniz. ## 👀 Misallar diff --git a/.github/README_es.md b/.github/README_es.md index a578230504..aa04c793aa 100644 --- a/.github/README_es.md +++ b/.github/README_es.md @@ -160,7 +160,7 @@ Fiber está **inspirado** en Expressjs, el framework web más popular en Interne ## ⚠️ Limitantes -- Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 3.0.0 ha sido probado con las versiones de Go 1.20 a 1.22. +- Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 3.0.0 ha sido probado con las versiones de Go 1.21 a 1.22. - Fiber no es compatible con interfaces net/http. Esto significa que no lo podrá usar en proyectos como qglgen, go-swagger, u otros que son parte del ecosistema net/http. ## 👀 Ejemplos diff --git a/.github/README_tr.md b/.github/README_tr.md index 2bf4714eec..1c870faf34 100644 --- a/.github/README_tr.md +++ b/.github/README_tr.md @@ -160,7 +160,7 @@ Fiber, internet üzerinde en popüler web framework'ü olan Express'ten **esinle ## ⚠️ Sınırlamalar -- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 3.0.0, Go 1.20 ile 1.22 sürümleriyle test edildi. +- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 3.0.0, Go 1.21 ile 1.22 sürümleriyle test edildi. - Fiber net/http arabirimiyle uyumlu değildir. Yani gqlgen veya go-swagger gibi net/http ekosisteminin parçası olan projeleri kullanamazsınız. ## 👀 Örnekler diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md index f0b5cd011a..e0b134b5b6 100644 --- a/.github/README_zh-CN.md +++ b/.github/README_zh-CN.md @@ -166,7 +166,7 @@ go get -u github.com/gofiber/fiber/v3 以及在互联网上的所有诉求,为了创建一个能让有着任何技术栈的开发者都能在 deadline 前完成任务的**迅速**,**灵活**以及**友好**的 `Go web` 框架,就像 `Express` 在 `JavaScript` 世界中一样。 ## ⚠️ 限制 -* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 3.0.0 已经在 Go 1.20 到 1.22 上测试过。 +* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 3.0.0 已经在 Go 1.21 到 1.22 上测试过。 * Fiber 与 net/http 接口不兼容。也就是说你无法直接使用例如 gqlen,go-swagger 或者任何其他属于 net/http 生态的项目。 ## 👀 示例 diff --git a/.github/README_zh-TW.md b/.github/README_zh-TW.md index 50352212a0..f561cb4ace 100644 --- a/.github/README_zh-TW.md +++ b/.github/README_zh-TW.md @@ -173,7 +173,7 @@ Fiber **啟發自** Express——網際網路上最知名的 Web 框架,我們 ## ⚠️ 限制 -- 由於 Fiber 有用到 Unsafe,本函式庫有時可能無法相容最新版的 Go 語言。Fiber 3.0.0 已在 Go 1.20 至 1.22 的版本測試過。 +- 由於 Fiber 有用到 Unsafe,本函式庫有時可能無法相容最新版的 Go 語言。Fiber 3.0.0 已在 Go 1.21 至 1.22 的版本測試過。 - Fiber 不相容 net/http 的介面,意味著您無法使用像是 gqlgen、go-swagger 或其他任何屬於 net/http 生態系統的專案。 ## 👀 範例 diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a4229ce993..6b2ad36b69 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-go@v5 with: # NOTE: Keep this in sync with the version from go.mod - go-version: "1.20.x" + go-version: "1.21.x" - name: Run Benchmark run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 188a68291e..6a4c3475a1 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-go@v5 with: # NOTE: Keep this in sync with the version from go.mod - go-version: "1.20.x" + go-version: "1.21.x" cache: false - name: golangci-lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dcc72a5eca..0cc3b2c60b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: Build: strategy: matrix: - go-version: [1.20.x, 1.21.x, 1.22.x] + go-version: [1.21.x, 1.22.x] platform: [ubuntu-latest, windows-latest, macos-latest, macos-14] runs-on: ${{ matrix.platform }} steps: diff --git a/go.mod b/go.mod index 6a628e715d..8f0b8b4833 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gofiber/fiber/v3 -go 1.20 +go 1.21 require ( github.com/gofiber/utils/v2 v2.0.0-beta.3 diff --git a/middleware/pprof/pprof.go b/middleware/pprof/pprof.go index 0deeb7dcee..bd6a58e72d 100644 --- a/middleware/pprof/pprof.go +++ b/middleware/pprof/pprof.go @@ -40,7 +40,7 @@ func New(config ...Config) fiber.Handler { path := c.Path() // We are only interested in /debug/pprof routes - path, found := cutPrefix(path, prefix) + path, found := strings.CutPrefix(path, prefix) if !found { return c.Next() } @@ -81,14 +81,3 @@ func New(config ...Config) fiber.Handler { return nil } } - -// cutPrefix is a copy of [strings.CutPrefix] added in Go 1.20. -// Remove this function when we drop support for Go 1.19. -// -//nolint:nonamedreturns // Align with its original form in std. -func cutPrefix(s, prefix string) (after string, found bool) { - if !strings.HasPrefix(s, prefix) { - return s, false - } - return s[len(prefix):], true -}