go安装gin框架

1,把下载好的包放到go安装目录src下
2.代码:test.go  运行>go run test.go
package main

import "github.com/gin-gonic/gin"

func main() {
   r := gin.Default()
   r.GET("/ping", func(c *gin.Context) {
      c.JSON(200, gin.H{
         "message": "pong",
      })
   })
   r.Run() // listen and serve on 0.0.0.0:8080
}
3.浏览器输入http://127.0.0.1:8080/ping

显示:

{"message":"pong"}