下载gin失败
解决办法:
cmd输入
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
即可安装gin包
go get github.com/gin-gonic/gin
goland中go.mod的require是灰色
解决办法:
即可愉快运行Demo
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
ginServer := gin.Default()
ginServer.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{"msg": "hello world"})
})
ginServer.Run(":8080")
}
标签:00,学习,go,gin,ginServer,main,gonic
From: https://www.cnblogs.com/nltack/p/18156611