创建Hello工程,进入到Hello目录下,go mod init 生成 go.mod
在其目录下新建文件夹main,并在其目录下新建main.go
main.go:
package main
import (
"fmt"
"github.com/astaxie/beego"
)
func main() {
fmt.Println("hello world")
beego.Run()
}
在main目录下 go build 生成go.sum,
期间出现 :在main目录出现pkg目录,go build 时出现:$GOPATH/go.mod exists but should not,将工程全部删除并重新创建
go: cannot determine module path for source directory /Users/admin/work/code/TestGrpc (outside GOPAT......
解决:https://blog.csdn.net/wide288/article/details/97776591