一、切换go代理
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
二、下载gin
go get -u -v github.com/gin-gonic/gin
三、测试
package main
import (
"github.com/gin-gonic/gin"
"net/http"
)
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "搭建完成")
})
r.Run(":8888") // 端口号8888
}
有问题请加博主微信进行沟通!
全部评论