Skip to content

Commit 90cf460

Browse files
authored
chore: update Go versions and dependencies for improved compatibility (#4187)
* chore: update Go versions and dependencies for improved compatibility - Update Go versions in workflow file to `1.23` and `1.24` - Enhance test tags in workflow with specific linker flags - Remove the conditional formatting step for Go `1.22.x` in workflow - Remove `goimports` settings from `.golangci.yml` - Update `go.mod` to use Go `1.23.0` - Upgrade `github.com/bytedance/sonic` from `v1.11.6` to `v1.13.1` - Update indirect dependencies `sonic/loader` to `v0.2.4` and `base64x` to `v0.1.5` in `go.mod` Signed-off-by: appleboy <[email protected]> * chore: update project for Go 1.23 compatibility and documentation fixes - Update Go version requirement from 1.22 to 1.23 in README.md - Remove superfluous `$` from example command in README.md - Update warning message to reflect new Go version requirement in debug.go - Update test assertion to reflect new Go version requirement in debug_test.go Signed-off-by: appleboy <[email protected]> --------- Signed-off-by: appleboy <[email protected]>
1 parent ebe5e2a commit 90cf460

File tree

7 files changed

+22
-25
lines changed

7 files changed

+22
-25
lines changed

.github/workflows/gin.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [ubuntu-latest, macos-latest]
36-
go: ["1.22", "1.23", "1.24"]
36+
go: ["1.23", "1.24"]
3737
test-tags:
38-
["", "-tags nomsgpack", '-tags "sonic avx"', "-tags go_json", "-race"]
38+
[
39+
"",
40+
"-tags nomsgpack",
41+
'--ldflags="-checklinkname=0" -tags "sonic avx"',
42+
"-tags go_json",
43+
"-race",
44+
]
3945
include:
4046
- os: ubuntu-latest
4147
go-build: ~/.cache/go-build
@@ -75,7 +81,3 @@ jobs:
7581
uses: codecov/codecov-action@v4
7682
with:
7783
flags: ${{ matrix.os }},go-${{ matrix.go }},${{ matrix.test-tags }}
78-
79-
- name: Format
80-
if: matrix.go-version == '1.22.x'
81-
run: diff -u <(echo -n) <(gofmt -d .)

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ linters-settings:
4242
int-conversion: true
4343
sprintf1: true
4444
strconcat: true
45-
goimports:
46-
fiximports: true
4745
testifylint:
4846
enable-all: true
4947

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you need performance and good productivity, you will love Gin.
3030

3131
### Prerequisites
3232

33-
Gin requires [Go](https://go.dev/) version [1.22](https://go.dev/doc/devel/release#go1.22.0) or above.
33+
Gin requires [Go](https://go.dev/) version [1.23](https://go.dev/doc/devel/release#go1.23.0) or above.
3434

3535
### Getting Gin
3636

@@ -73,7 +73,7 @@ func main() {
7373
To run the code, use the `go run` command, like:
7474

7575
```sh
76-
$ go run example.go
76+
go run example.go
7777
```
7878

7979
Then visit [`0.0.0.0:8080/ping`](http://0.0.0.0:8080/ping) in your browser to see the response!

debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func getMinVer(v string) (uint64, error) {
7878

7979
func debugPrintWARNINGDefault() {
8080
if v, e := getMinVer(runtime.Version()); e == nil && v < ginSupportMinGoVer {
81-
debugPrint(`[WARNING] Now Gin requires Go 1.22+.
81+
debugPrint(`[WARNING] Now Gin requires Go 1.23+.
8282
8383
`)
8484
}

debug_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func TestDebugPrintWARNINGDefault(t *testing.T) {
106106
})
107107
m, e := getMinVer(runtime.Version())
108108
if e == nil && m < ginSupportMinGoVer {
109-
assert.Equal(t, "[GIN-debug] [WARNING] Now Gin requires Go 1.22+.\n\n[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)
109+
assert.Equal(t, "[GIN-debug] [WARNING] Now Gin requires Go 1.23+.\n\n[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)
110110
} else {
111111
assert.Equal(t, "[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)
112112
}

go.mod

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module github.com/gin-gonic/gin
22

3-
go 1.22
4-
toolchain go1.23.7
3+
go 1.23.0
54

65
require (
7-
github.com/bytedance/sonic v1.11.6
6+
github.com/bytedance/sonic v1.13.1
87
github.com/gin-contrib/sse v0.1.0
98
github.com/go-playground/validator/v10 v10.22.1
109
github.com/goccy/go-json v0.10.2
@@ -20,9 +19,8 @@ require (
2019
)
2120

2221
require (
23-
github.com/bytedance/sonic/loader v0.1.1 // indirect
24-
github.com/cloudwego/base64x v0.1.4 // indirect
25-
github.com/cloudwego/iasm v0.2.0 // indirect
22+
github.com/bytedance/sonic/loader v0.2.4 // indirect
23+
github.com/cloudwego/base64x v0.1.5 // indirect
2624
github.com/davecgh/go-spew v1.1.1 // indirect
2725
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
2826
github.com/go-playground/locales v0.14.1 // indirect

go.sum

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
2-
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
3-
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
1+
github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=
2+
github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
43
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
4+
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
5+
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
56
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
67
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
78
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
8-
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
9-
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
10-
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
9+
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
10+
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
1111
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
1212
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1313
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -112,4 +112,3 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
112112
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
113113
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
114114
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
115-
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

0 commit comments

Comments
 (0)