Skip to content

Commit 7e29806

Browse files
authored
build: update Gin minimum Go version to 1.21 (#3960)
* build: update Gin minimum Go version to 1.21 - Update the minimum Go version requirement for Gin from `1.20` to `1.21` in both `debug.go` and `debug_test.go` - Modify the warning message to reflect the new minimum Go version requirement in `debug.go` - Adjust the test assertion to match the updated warning message in `debug_test.go` Signed-off-by: Bo-Yi Wu <[email protected]> * docs: refine project documentation and CI configurations - Update supported Go versions for GitHub actions to `1.21` and `1.22` - Specify the required Go version as `1.21` or above in README - Change code block syntax to `sh` in installation and demo run instructions - Remove empty lines in README sections - Update project list formatting without changing the content Signed-off-by: Bo-Yi Wu <[email protected]> --------- Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 3ac729d commit 7e29806

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

.github/workflows/gin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [ubuntu-latest, macos-latest]
36-
go: ["1.20", "1.21", "1.22"]
36+
go: ["1.21", "1.22"]
3737
test-tags:
3838
["", "-tags nomsgpack", '-tags "sonic avx"', "-tags go_json", "-race"]
3939
include:

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ Gin is a web framework written in [Go](https://go.dev/). It features a martini-l
2525
- Rendering built-in
2626
- Extendable
2727

28-
2928
## Getting started
3029

3130
### Prerequisites
3231

33-
- **[Go](https://go.dev/)**: any one of the **three latest major** [releases](https://go.dev/doc/devel/release) (we test it with these).
32+
The required version of [Go](https://go.dev/) language is [1.21](https://go.dev/doc/devel/release#go1.21.0) or above.
3433

3534
### Getting Gin
3635

3736
With [Go module](https://github.com/golang/go/wiki/Modules) support, simply add the following import
3837

39-
```
38+
```sh
4039
import "github.com/gin-gonic/gin"
4140
```
4241

@@ -45,7 +44,7 @@ to your code, and then `go [build|run|test]` will automatically fetch the necess
4544
Otherwise, run the following Go command to install the `gin` package:
4645

4746
```sh
48-
$ go get -u github.com/gin-gonic/gin
47+
go get -u github.com/gin-gonic/gin
4948
```
5049

5150
### Running Gin
@@ -74,7 +73,7 @@ func main() {
7473

7574
And use the Go command to run the demo:
7675

77-
```
76+
```sh
7877
# run example.go and visit 0.0.0.0:8080/ping on browser
7978
$ go run example.go
8079
```
@@ -89,7 +88,6 @@ Learn and practice more examples, please read the [Gin Quick Start](docs/doc.md)
8988

9089
A number of ready-to-run examples demonstrating various use cases of Gin on the [Gin examples](https://github.com/gin-gonic/examples) repository.
9190

92-
9391
## Documentation
9492

9593
See [API documentation and descriptions](https://godoc.org/github.com/gin-gonic/gin) for package.
@@ -153,23 +151,20 @@ Gin uses a custom version of [HttpRouter](https://github.com/julienschmidt/httpr
153151
- (3): Heap Memory (B/op), lower is better
154152
- (4): Average Allocations per Repetition (allocs/op), lower is better
155153

156-
157154
## Middlewares
158155

159156
You can find many useful Gin middlewares at [gin-contrib](https://github.com/gin-contrib).
160157

161-
162158
## Users
163159

164160
Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framework.
165161

166-
* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.
167-
* [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform.
168-
* [photoprism](https://github.com/photoprism/photoprism): Personal photo management powered by Go and Google TensorFlow.
169-
* [lura](https://github.com/luraproject/lura): Ultra performant API Gateway with middlewares.
170-
* [picfit](https://github.com/thoas/picfit): An image resizing server written in Go.
171-
* [dkron](https://github.com/distribworks/dkron): Distributed, fault tolerant job scheduling system.
172-
162+
- [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.
163+
- [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform.
164+
- [photoprism](https://github.com/photoprism/photoprism): Personal photo management powered by Go and Google TensorFlow.
165+
- [lura](https://github.com/luraproject/lura): Ultra performant API Gateway with middlewares.
166+
- [picfit](https://github.com/thoas/picfit): An image resizing server written in Go.
167+
- [dkron](https://github.com/distribworks/dkron): Distributed, fault tolerant job scheduling system.
173168

174169
## Contributing
175170

debug.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"sync/atomic"
1414
)
1515

16-
const ginSupportMinGoVer = 18
16+
const ginSupportMinGoVer = 21
1717

1818
// IsDebugging returns true if the framework is running in debug mode.
1919
// Use SetMode(gin.ReleaseMode) to disable debug mode.
@@ -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.20+.
81+
debugPrint(`[WARNING] Now Gin requires Go 1.21+.
8282
8383
`)
8484
}

debug_test.go

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

0 commit comments

Comments
 (0)