Skip to content
Myr

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

6 files+26 added−40 removed

modified:.travis.yml-2 removed
modified:debug_test.go+1 added-1 removed
102 unmodified lines
103 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 lines
modified:debug.go+2 added-2 removed
10 unmodified lines
11 "strconv"12 "strings"13)1415const ginSupportMinGoVer = 1215const ginSupportMinGoVer = 131617// IsDebugging returns true if the framework is running in debug mode.18// Use SetMode(gin.ReleaseMode) to disable debug mode.19func IsDebugging() bool {
46 unmodified lines
66}6768func 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+.7172`)73 }74 debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
29 unmodified lines
deleted:errors_1.13_test.go-34 removed
1//go:build go1.132// +build go1.1334package gin56import (7 "errors"8 "fmt"9 "testing"1011 "github.com/stretchr/testify/assert"12)1314type TestErr string1516func (e TestErr) Error() string { return string(e) }1718// 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.21func TestErrorUnwrap(t *testing.T) {22 innerErr := TestErr("somme error")2324 // 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 })2930 // 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 lines
5package gin67import (8 "errors"9 "fmt"10 "testing"1112 "github.com/gin-gonic/gin/internal/json"13 "github.com/stretchr/testify/assert"
90 unmodified lines
104 assert.Nil(t, errs.Last())105 assert.Nil(t, errs.JSON())106 assert.Empty(t, errs.String())107}108109type TestErr string110111func (e TestErr) Error() string { return string(e) }112113// 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.115func TestErrorUnwrap(t *testing.T) {116 innerErr := TestErr("somme error")117118 // 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 })123124 // 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 lines
83## Installation8485To install Gin package, you need to install Go and set your Go workspace first.86871. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.871. The first need [Go](https://golang.org/) installed (**version 1.13+ is required**), then you can use the below Go command to install Gin.8889```sh90$ go get -u github.com/gin-gonic/gin91```
2126 unmodified lines