Skip to content
Myr

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

3 files+64 added−54 removed

modified:debug_test.go+1 added-1 removed
90 unmodified lines
91 setup(&w)92 defer teardown()9394 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}9798func TestDebugPrintWARNINGNew(t *testing.T) {99 var w bytes.Buffer
16 unmodified lines
modified:debug.go+3 added
45 unmodified lines
46 }47}4849func debugPrintWARNINGDefault() {50 debugPrint(`[WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.5152`)53 debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.5455`)56}
24 unmodified lines
modified:README.md+60 added-53 removed
13 unmodified lines
14![Gin console logger](https://gin-gonic.github.io/gin/other/console.png)1516## Contents1718- [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 lines
58 - [http2 server push](#http2-server-push)59- [Testing](#testing)60- [Users](#users--)6162## Installation6364To install Gin package, you need to install Go and set your Go workspace first.65661. Download and install it:6768```sh69$ go get -u github.com/gin-gonic/gin70```71722. Import it in your code:7374```go75import "github.com/gin-gonic/gin"76```77783. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.7980```go81import "net/http"82```8384### Use a vendor tool like [Govendor](https://github.com/kardianos/govendor)85861. `go get` govendor8788```sh89$ go get github.com/kardianos/govendor90```912. Create your project folder and `cd` inside9293```sh94$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"95```96973. Vendor init your project and add gin9899```sh100$ govendor init101$ govendor fetch github.com/gin-gonic/gin@v1.2102```1031044. Copy a starting template inside your project105106```sh107$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go108```1091105. Run your project111112```sh113$ go run main.go114```115116## Prerequisite117118Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.119120## Quick start121 122```sh123# assume the following codes in example.go file
69 unmodified lines
193- [x] Complete suite of unit tests194- [x] Battle tested195- [x] API frozen, new releases will not break your code.196138## Start using it1391401. Download and install it:141142```sh143$ go get github.com/gin-gonic/gin144```1451462. Import it in your code:147148```go149import "github.com/gin-gonic/gin"150```1511523. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.153154```go155import "net/http"156```157158### Use a vendor tool like [Govendor](https://github.com/kardianos/govendor)1591601. `go get` govendor161162```sh163$ go get github.com/kardianos/govendor164```1652. Create your project folder and `cd` inside166167```sh168$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"169```1701713. Vendor init your project and add gin172173```sh174$ govendor init175$ govendor fetch github.com/gin-gonic/gin@v1.2176```1771784. Copy a starting template inside your project179180```sh181$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go182```1831845. Run your project185186```sh187$ go run main.go188```189197## Build with [jsoniter](https://github.com/json-iterator/go)198199Gin 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