Installation

To install Gin package, you need to install Go and set your Go workspace first.

  1. Download and install it:
  1. $ go get -u github.com/gin-gonic/gin
  1. Import it in your code:
  1. import "github.com/gin-gonic/gin"
  1. (Optional) Import net/http. This is required for example if using constants such as http.StatusOK.
  1. import "net/http"

Use a vendor tool like Govendor

  1. go get govendor
  1. $ go get github.com/kardianos/govendor
  1. Create your project folder and cd inside
  1. $ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"
  1. Vendor init your project and add gin
  1. $ govendor init
  2. $ govendor fetch github.com/gin-gonic/gin@v1.2
  1. Copy a starting template inside your project
  1. $ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go
  1. Run your project
  1. $ go run main.go