Skip to content

Commit

Permalink
🧹 v3 (chore): Bump minimum version of Go to 1.21 (#2911)
Browse files Browse the repository at this point in the history
Bump Go minimum version to 1.21
  • Loading branch information
gaby authored Mar 10, 2024
1 parent 0379cc5 commit 3216879
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 26 deletions.
9 changes: 4 additions & 5 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/README_az.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/README_tr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 生态的项目。

## 👀 示例
Expand Down
2 changes: 1 addition & 1 deletion .github/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 生態系統的專案。

## 👀 範例
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 1 addition & 12 deletions middleware/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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
}

1 comment on commit 3216879

@ReneWerner87
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 3216879 Previous: d2b19e2 Ratio
Benchmark_Etag 200.1 ns/op 0 B/op 0 allocs/op 98.08 ns/op 0 B/op 0 allocs/op 2.04
Benchmark_Middleware_Favicon 209.1 ns/op 12 B/op 4 allocs/op 90.01 ns/op 3 B/op 1 allocs/op 2.32

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.