Start using it
- Download and install it:
$ go get github.com/gin-gonic/gin
- Import it in your code:
import "github.com/gin-gonic/gin"
- (Optional) Import
net/http
. This is required for example if using constants such as http.StatusOK
.
import "net/http"
go get
govendor
$ go get github.com/kardianos/govendor
- Create your project folder and
cd
inside
$ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"
- Vendor init your project and add gin
$ govendor init
$ govendor fetch github.com/gin-gonic/[email protected]
- Copy a starting template inside your project
$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go
- Run your project
$ go run main.go