mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-19 07:38:57 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
9ec65d6f38
@ -17,7 +17,7 @@ before_install:
|
||||
- if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fi
|
||||
|
||||
install:
|
||||
- if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else make install; fi
|
||||
- if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
|
||||
- if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
|
||||
- if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
|
||||
|
||||
|
16
Makefile
16
Makefile
@ -1,15 +1,10 @@
|
||||
GO ?= go
|
||||
GOFMT ?= gofmt "-s"
|
||||
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
|
||||
VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/ | grep -v /examples/)
|
||||
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
|
||||
PACKAGES ?= $(shell $(GO) list ./...)
|
||||
VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /examples/)
|
||||
GOFILES := $(shell find . -name "*.go")
|
||||
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|binding$$|render$$' | grep -v examples)
|
||||
|
||||
all: install
|
||||
|
||||
install: deps
|
||||
govendor sync
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
echo "mode: count" > coverage.out
|
||||
@ -48,11 +43,6 @@ fmt-check:
|
||||
vet:
|
||||
$(GO) vet $(VETPACKAGES)
|
||||
|
||||
deps:
|
||||
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/kardianos/govendor; \
|
||||
fi
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
|
38
README.md
38
README.md
@ -88,44 +88,6 @@ import "github.com/gin-gonic/gin"
|
||||
import "net/http"
|
||||
```
|
||||
|
||||
### Use a vendor tool like [Govendor](https://github.com/kardianos/govendor)
|
||||
|
||||
1. `go get` govendor
|
||||
|
||||
```sh
|
||||
$ go get github.com/kardianos/govendor
|
||||
```
|
||||
2. Create your project folder and `cd` inside
|
||||
|
||||
```sh
|
||||
$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"
|
||||
```
|
||||
|
||||
If you are on a Mac and you're installing Go 1.8 (released: Feb 2017) or later, GOPATH is automatically determined by the Go toolchain for you. It defaults to $HOME/go on macOS so you can create your project like this
|
||||
|
||||
```sh
|
||||
$ mkdir -p $HOME/go/src/github.com/myusername/project && cd "$_"
|
||||
```
|
||||
|
||||
3. Vendor init your project and add gin
|
||||
|
||||
```sh
|
||||
$ govendor init
|
||||
$ govendor fetch github.com/gin-gonic/gin@v1.3
|
||||
```
|
||||
|
||||
4. Copy a starting template inside your project
|
||||
|
||||
```sh
|
||||
$ curl https://raw.githubusercontent.com/gin-gonic/examples/master/basic/main.go > main.go
|
||||
```
|
||||
|
||||
5. Run your project
|
||||
|
||||
```sh
|
||||
$ go run main.go
|
||||
```
|
||||
|
||||
## Quick start
|
||||
|
||||
```sh
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"gopkg.in/go-playground/validator.v9"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type defaultValidator struct {
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/go-playground/validator.v9"
|
||||
)
|
||||
|
||||
type testInterface interface {
|
||||
|
6
go.mod
6
go.mod
@ -4,15 +4,11 @@ go 1.12
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/sse v0.1.0
|
||||
github.com/go-playground/locales v0.12.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.16.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.0.1
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/json-iterator/go v1.1.7
|
||||
github.com/leodido/go-urn v1.1.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.9
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/ugorji/go/codec v1.1.7
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
)
|
||||
|
22
go.sum
22
go.sum
@ -3,17 +3,21 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM=
|
||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.0.1 h1:QgDDZpXlR/L3atIL2PbFt0TpazbtN7N6PxTGcgcyEUg=
|
||||
github.com/go-playground/validator/v10 v10.0.1/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
|
||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
|
||||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
@ -32,11 +36,9 @@ github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
153
vendor/vendor.json
vendored
153
vendor/vendor.json
vendored
@ -1,153 +0,0 @@
|
||||
{
|
||||
"comment": "v1.4.0",
|
||||
"ignore": "test",
|
||||
"package": [
|
||||
{
|
||||
"checksumSHA1": "CSPbwbyzqA6sfORicn4HFtIhF/c=",
|
||||
"path": "github.com/davecgh/go-spew/spew",
|
||||
"revision": "8991bc29aa16c548c550c7ff78260e27b9ab7c73",
|
||||
"revisionTime": "2018-02-21T22:46:20Z",
|
||||
"version": "v1.1",
|
||||
"versionExact": "v1.1.1"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "qlEzrgKgIkh7y0ePm9BNo1cNdXo=",
|
||||
"path": "github.com/gin-contrib/sse",
|
||||
"revision": "54d8467d122d380a14768b6b4e5cd7ca4755938f",
|
||||
"revisionTime": "2019-06-02T15:02:53Z",
|
||||
"version": "v0.1",
|
||||
"versionExact": "v0.1.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "b4DmyMT9bicTRVJw1hJXHLhIH+0=",
|
||||
"path": "github.com/go-playground/locales",
|
||||
"revision": "f63010822830b6fe52288ee52d5a1151088ce039",
|
||||
"revisionTime": "2018-03-23T16:04:04Z",
|
||||
"version": "v0.12",
|
||||
"versionExact": "v0.12.1"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "JgF260rC9YpWyY5WEljjimWLUXs=",
|
||||
"path": "github.com/go-playground/locales/currency",
|
||||
"revision": "630ebbb602847eba93e75ae38bbc7bb7abcf1ff3",
|
||||
"revisionTime": "2019-04-30T15:33:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "9pKcUHBaVS+360X6h4IowhmOPjk=",
|
||||
"path": "github.com/go-playground/universal-translator",
|
||||
"revision": "b32fa301c9fe55953584134cb6853a13c87ec0a1",
|
||||
"revisionTime": "2017-02-09T16:11:52Z",
|
||||
"version": "v0.16",
|
||||
"versionExact": "v0.16.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Y2MOwzNZfl4NRNDbLCZa6sgx7O0=",
|
||||
"path": "github.com/golang/protobuf/proto",
|
||||
"revision": "c823c79ea1570fb5ff454033735a8e68575d1d0f",
|
||||
"revisionTime": "2019-02-05T22:20:52Z",
|
||||
"version": "v1.3",
|
||||
"versionExact": "v1.3.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "zNo6yGy/bCJuzkEcP70oEBtOB2M=",
|
||||
"path": "github.com/leodido/go-urn",
|
||||
"revision": "70078a794e8ea4b497ba7c19a78cd60f90ccf0f4",
|
||||
"revisionTime": "2018-05-24T03:26:21Z",
|
||||
"version": "v1.1",
|
||||
"versionExact": "v1.1.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "TB2vxux9xQbvsTHOVt4aRTuvSn4=",
|
||||
"path": "github.com/json-iterator/go",
|
||||
"revision": "0ff49de124c6f76f8494e194af75bde0f1a49a29",
|
||||
"revisionTime": "2019-03-06T14:29:09Z",
|
||||
"version": "v1.1",
|
||||
"versionExact": "v1.1.6"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Ya+baVBU/RkXXUWD3LGFmGJiiIg=",
|
||||
"path": "github.com/mattn/go-isatty",
|
||||
"revision": "c2a7a6ca930a4cd0bc33a3f298eb71960732a3a7",
|
||||
"revisionTime": "2019-03-12T13:58:54Z",
|
||||
"version": "v0.0",
|
||||
"versionExact": "v0.0.7"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ZTcgWKWHsrX0RXYVXn5Xeb8Q0go=",
|
||||
"path": "github.com/modern-go/concurrent",
|
||||
"revision": "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94",
|
||||
"revisionTime": "2018-03-06T01:26:44Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "qvH48wzTIV3QKSDqI0dLFtVjaDI=",
|
||||
"path": "github.com/modern-go/reflect2",
|
||||
"revision": "94122c33edd36123c84d5368cfb2b69df93a0ec8",
|
||||
"revisionTime": "2018-07-18T01:23:57Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "LuFv4/jlrmFNnDb/5SCSEPAM9vU=",
|
||||
"path": "github.com/pmezard/go-difflib/difflib",
|
||||
"revision": "5d4384ee4fb2527b0a1256a821ebfc92f91efefc",
|
||||
"revisionTime": "2018-12-26T10:54:42Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "cpNsoLqBprpKh+VZTBOZNVXzBEk=",
|
||||
"path": "github.com/stretchr/objx",
|
||||
"revision": "c61a9dfcced1815e7d40e214d00d1a8669a9f58c",
|
||||
"revisionTime": "2019-02-11T16:23:28Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "DBdcVxnvaINHhWyyGgih/Mel6gE=",
|
||||
"path": "github.com/stretchr/testify",
|
||||
"revision": "ffdc059bfe9ce6a4e144ba849dbedead332c6053",
|
||||
"revisionTime": "2018-12-05T02:12:43Z",
|
||||
"version": "v1.3",
|
||||
"versionExact": "v1.3.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "c6pbpF7eowwO59phRTpF8cQ80Z0=",
|
||||
"path": "github.com/stretchr/testify/assert",
|
||||
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
|
||||
"revisionTime": "2018-05-06T18:05:49Z",
|
||||
"version": "v1.2",
|
||||
"versionExact": "v1.2.2"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "wnEANt4k5X/KGwoFyfSSnpxULm4=",
|
||||
"path": "github.com/stretchr/testify/require",
|
||||
"revision": "f35b8ab0b5a2cef36673838d662e249dd9c94686",
|
||||
"revisionTime": "2018-05-06T18:05:49Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "S4ei9eSqVThDio0Jn2sav6yUbvg=",
|
||||
"path": "github.com/ugorji/go/codec",
|
||||
"revision": "82dbfaf494e3b01d2d481376f11f6a5c8cf9599f",
|
||||
"revisionTime": "2019-07-02T14:15:27Z",
|
||||
"version": "v1.1",
|
||||
"versionExact": "v1.1.6"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "2gaep1KNRDNyDA3O+KgPTQsGWvs=",
|
||||
"path": "golang.org/x/sys/unix",
|
||||
"revision": "a43fa875dd822b81eb6d2ad538bc1f4caba169bd",
|
||||
"revisionTime": "2019-05-02T15:41:39Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ACzc7AkwLtNgKhqtj8V7SGUJgnw=",
|
||||
"path": "gopkg.in/go-playground/validator.v9",
|
||||
"revision": "46b4b1e301c24cac870ffcb4ba5c8a703d1ef475",
|
||||
"revisionTime": "2019-03-31T13:31:25Z",
|
||||
"version": "v9.28",
|
||||
"versionExact": "v9.28.0"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "QqDq2x8XOU7IoOR98Cx1eiV5QY8=",
|
||||
"path": "gopkg.in/yaml.v2",
|
||||
"revision": "51d6538a90f86fe93ac480b35f37b2be17fef232",
|
||||
"revisionTime": "2018-11-15T11:05:04Z",
|
||||
"version": "v2.2",
|
||||
"versionExact": "v2.2.2"
|
||||
}
|
||||
],
|
||||
"rootPath": "github.com/gin-gonic/gin"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user