Skip to content

Commit

Permalink
ci: update Go version requirements and remove test files (#3957)
Browse files Browse the repository at this point in the history
- Update the Go version requirements in `.github/workflows/gin.yml`
- Remove test files for Go versions 1.18 and 1.19
- Update the required Go version in `debug.go` and `debug_test.go`
- Rename and modify files related to Go version 1.19 and 1.20 in the `internal/bytesconv` directory

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed May 8, 2024
1 parent 7d14792 commit b1c1e7b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gin.yml
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: ["1.18", "1.19", "1.20", "1.21", "1.22"]
go: ["1.20", "1.21", "1.22"]
test-tags:
["", "-tags nomsgpack", '-tags "sonic avx"', "-tags go_json", "-race"]
include:
Expand Down
37 changes: 0 additions & 37 deletions context_1.18_test.go

This file was deleted.

30 changes: 0 additions & 30 deletions context_1.19_test.go

This file was deleted.

13 changes: 13 additions & 0 deletions context_test.go
Expand Up @@ -90,6 +90,19 @@ func TestContextFormFile(t *testing.T) {
assert.NoError(t, c.SaveUploadedFile(f, "test"))
}

func TestContextFormFileFailed(t *testing.T) {
buf := new(bytes.Buffer)
mw := multipart.NewWriter(buf)
mw.Close()
c, _ := CreateTestContext(httptest.NewRecorder())
c.Request, _ = http.NewRequest("POST", "/", nil)
c.Request.Header.Set("Content-Type", mw.FormDataContentType())
c.engine.MaxMultipartMemory = 8 << 20
f, err := c.FormFile("file")
assert.Error(t, err)
assert.Nil(t, f)
}

func TestContextMultipartForm(t *testing.T) {
buf := new(bytes.Buffer)
mw := multipart.NewWriter(buf)
Expand Down
2 changes: 1 addition & 1 deletion debug.go
Expand Up @@ -78,7 +78,7 @@ func getMinVer(v string) (uint64, error) {

func debugPrintWARNINGDefault() {
if v, e := getMinVer(runtime.Version()); e == nil && v < ginSupportMinGoVer {
debugPrint(`[WARNING] Now Gin requires Go 1.18+.
debugPrint(`[WARNING] Now Gin requires Go 1.20+.
`)
}
Expand Down
2 changes: 1 addition & 1 deletion debug_test.go
Expand Up @@ -104,7 +104,7 @@ func TestDebugPrintWARNINGDefault(t *testing.T) {
})
m, e := getMinVer(runtime.Version())
if e == nil && m < ginSupportMinGoVer {
assert.Equal(t, "[GIN-debug] [WARNING] Now Gin requires Go 1.18+.\n\n[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)
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)
} else {
assert.Equal(t, "[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)
}
Expand Down
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

//go:build go1.20

package bytesconv

import (
Expand Down
26 changes: 0 additions & 26 deletions internal/bytesconv/bytesconv_1.19.go

This file was deleted.

0 comments on commit b1c1e7b

Please sign in to comment.