gin+gorm

在【环境变量】中添加如下【用户变量】/【系统变量】:
GO111MODULE,值为on

go mod init目录

在项目中新建文件main.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 }

当前
go build
 

猜你喜欢

转载自www.cnblogs.com/apesplan/p/10792052.html