执行 go run main.go 运行代码会发现 go mod 会自动查找依赖自动下载
结果报错
1 2 | routers\router.go:5:2: no required module provides package github.com/astaxie/beego; to add it: |
执行:go mod edit -require github.com/astaxie/beego@latest 解决,指定Gin的版本
再次运行 go run main.go 报错
1 2 | PS H:\Go\src\crm> go run main.go |
然后执行 go mod tidy 再次执行 go run main.go 终于跑起来了