add go version prerequisite and debug warning (#1394)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* add go version prerequisite and debug warning * merge duplicate content * remove duplicate content
authored by 田欧 · committed by Bo-Yi Wu · parent 6c6d97b · Browse files · 3 files·+64 added−54 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+64 added−54 removed
- other:+64 added−54 removed
Provenance
- Commit
c00f21f- Tree
bc5f39d- Author
田欧 <thinkerou@gmail.com>- Committer
Bo-Yi Wu <appleboy.tw@gmail.com>- Parent
6c6d97b
3 files changed+64 added−54 removed
modified:debug_test.go+1 added-1 removed
90 unmodified lines91 setup(&w)92 defer teardown()93 94 debugPrintWARNINGDefault()95- assert.Equal(t, "[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", w.String())95+ assert.Equal(t, "[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.\n\n[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n", w.String())96 }97 98 func TestDebugPrintWARNINGNew(t *testing.T) {99 var w bytes.Buffer16 unmodified linesmodified:debug.go+3 added
45 unmodified lines46 }47 }48 49 func debugPrintWARNINGDefault() {50+ debugPrint(`[WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.51+52+`)53 debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.54 55 `)56 }24 unmodified linesmodified:README.md+60 added-53 removed
13 unmodified lines14 15 16 ## Contents17 18+- [Installation](#installation)19+- [Prerequisite](#prerequisite)20 - [Quick start](#quick-start)21 - [Benchmarks](#benchmarks)22 - [Gin v1.stable](#gin-v1-stable)21-- [Start using it](#start-using-it)23 - [Build with jsoniter](#build-with-jsoniter)24 - [API Examples](#api-examples)25 - [Using GET,POST,PUT,PATCH,DELETE and OPTIONS](#using-get-post-put-patch-delete-and-options)26 - [Parameters in path](#parameters-in-path)31 unmodified lines58 - [http2 server push](#http2-server-push)59 - [Testing](#testing)60 - [Users](#users--)61 62+## Installation63+64+To install Gin package, you need to install Go and set your Go workspace first.65+66+1. Download and install it:67+68+```sh69+$ go get -u github.com/gin-gonic/gin70+```71+72+2. Import it in your code:73+74+```go75+import "github.com/gin-gonic/gin"76+```77+78+3. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.79+80+```go81+import "net/http"82+```83+84+### Use a vendor tool like [Govendor](https://github.com/kardianos/govendor)85+86+1. `go get` govendor87+88+```sh89+$ go get github.com/kardianos/govendor90+```91+2. Create your project folder and `cd` inside92+93+```sh94+$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"95+```96+97+3. Vendor init your project and add gin98+99+```sh100+$ govendor init101+$ govendor fetch github.com/gin-gonic/gin@v1.2102+```103+104+4. Copy a starting template inside your project105+106+```sh107+$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go108+```109+110+5. Run your project111+112+```sh113+$ go run main.go114+```115+116+## Prerequisite117+118+Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.119+120 ## Quick start121 122 ```sh123 # assume the following codes in example.go file69 unmodified lines193 - [x] Complete suite of unit tests194 - [x] Battle tested195 - [x] API frozen, new releases will not break your code.196 138-## Start using it139-140-1. Download and install it:141-142-```sh143-$ go get github.com/gin-gonic/gin144-```145-146-2. Import it in your code:147-148-```go149-import "github.com/gin-gonic/gin"150-```151-152-3. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.153-154-```go155-import "net/http"156-```157-158-### Use a vendor tool like [Govendor](https://github.com/kardianos/govendor)159-160-1. `go get` govendor161-162-```sh163-$ go get github.com/kardianos/govendor164-```165-2. Create your project folder and `cd` inside166-167-```sh168-$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"169-```170-171-3. Vendor init your project and add gin172-173-```sh174-$ govendor init175-$ govendor fetch github.com/gin-gonic/gin@v1.2176-```177-178-4. Copy a starting template inside your project179-180-```sh181-$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go182-```183-184-5. Run your project185-186-```sh187-$ go run main.go188-```189-197 ## Build with [jsoniter](https://github.com/json-iterator/go)198 199 Gin use `encoding/json` as default json package but you can change to [jsoniter](https://github.com/json-iterator/go) by build from other tags.200 1567 unmodified lines