Remove go1.12 support (#2679)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Revert "Adding ppc64le architecture support on travis-ci (#2538)" This reverts commit fca3f95d7cdfdef203c78f220b84118f44590512. * not support go1.12 * fix * Update errors_test.go * Update debug.go
authored by thinkerou · committed by GitHub · parent 51c7d00 · Browse files · 6 files·+26 added−40 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+26 added−40 removed
- other:+26 added−40 removed
Provenance
- Commit
ee4de84- Tree
3f9d67e- Author
thinkerou <thinkerou@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
51c7d00
6 files changed+26 added−40 removed
modified:.travis.yml-2 removed
1234567678939 unmodified lineslanguage: go
matrix: fast_finish: true include: - go: 1.12.x env: GO111MODULE=on - go: 1.13.x - go: 1.13.x env: - TESTTAGS=nomsgpack39 unmodified linesmodified:debug_test.go+1 added-1 removed
102 unmodified lines103 SetMode(TestMode)104 })105 m, e := getMinVer(runtime.Version())106 if e == nil && m <= ginSupportMinGoVer {107- assert.Equal(t, "[GIN-debug] [WARNING] Now Gin requires Go 1.12+.\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.13+.\n\n[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)108 } else {109 assert.Equal(t, "[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", re)110 }111 }55 unmodified linesmodified:debug.go+2 added-2 removed
10 unmodified lines11 "strconv"12 "strings"13 )14 15-const ginSupportMinGoVer = 1215+const ginSupportMinGoVer = 1316 17 // IsDebugging returns true if the framework is running in debug mode.18 // Use SetMode(gin.ReleaseMode) to disable debug mode.19 func IsDebugging() bool {46 unmodified lines66 }67 68 func debugPrintWARNINGDefault() {69 if v, e := getMinVer(runtime.Version()); e == nil && v <= ginSupportMinGoVer {70- debugPrint(`[WARNING] Now Gin requires Go 1.12+.70+ debugPrint(`[WARNING] Now Gin requires Go 1.13+.71 72 `)73 }74 debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.29 unmodified linesdeleted:errors_1.13_test.go-34 removed
1-//go:build go1.132-// +build go1.133-4-package gin5-6-import (7- "errors"8- "fmt"9- "testing"10-11- "github.com/stretchr/testify/assert"12-)13-14-type TestErr string15-16-func (e TestErr) Error() string { return string(e) }17-18-// TestErrorUnwrap tests the behavior of gin.Error with "errors.Is()" and "errors.As()".19-// "errors.Is()" and "errors.As()" have been added to the standard library in go 1.13,20-// hence the "// +build go1.13" directive at the beginning of this file.21-func TestErrorUnwrap(t *testing.T) {22- innerErr := TestErr("somme error")23-24- // 2 layers of wrapping : use 'fmt.Errorf("%w")' to wrap a gin.Error{}, which itself wraps innerErr25- err := fmt.Errorf("wrapped: %w", &Error{26- Err: innerErr,27- Type: ErrorTypeAny,28- })29-30- // check that 'errors.Is()' and 'errors.As()' behave as expected :31- assert.True(t, errors.Is(err, innerErr))32- var testErr TestErr33- assert.True(t, errors.As(err, &testErr))34-}modified:errors_test.go+22 added
4 unmodified lines5 package gin6 7 import (8 "errors"9+ "fmt"10 "testing"11 12 "github.com/gin-gonic/gin/internal/json"13 "github.com/stretchr/testify/assert"90 unmodified lines104 assert.Nil(t, errs.Last())105 assert.Nil(t, errs.JSON())106 assert.Empty(t, errs.String())107 }108+109+type TestErr string110+111+func (e TestErr) Error() string { return string(e) }112+113+// TestErrorUnwrap tests the behavior of gin.Error with "errors.Is()" and "errors.As()".114+// "errors.Is()" and "errors.As()" have been added to the standard library in go 1.13.115+func TestErrorUnwrap(t *testing.T) {116+ innerErr := TestErr("somme error")117+118+ // 2 layers of wrapping : use 'fmt.Errorf("%w")' to wrap a gin.Error{}, which itself wraps innerErr119+ err := fmt.Errorf("wrapped: %w", &Error{120+ Err: innerErr,121+ Type: ErrorTypeAny,122+ })123+124+ // check that 'errors.Is()' and 'errors.As()' behave as expected :125+ assert.True(t, errors.Is(err, innerErr))126+ var testErr TestErr127+ assert.True(t, errors.As(err, &testErr))128+}modified:README.md+1 added-1 removed
82 unmodified lines83 ## Installation84 85 To install Gin package, you need to install Go and set your Go workspace first.86 87-1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.87+1. The first need [Go](https://golang.org/) installed (**version 1.13+ is required**), then you can use the below Go command to install Gin.88 89 ```sh90 $ go get -u github.com/gin-gonic/gin91 ```2126 unmodified lines