Go语言使用时常常会遇到的一些错误及解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下
1、go: go.mod file not found in current directory or any parent directory
go mod init name
2、Failed to build the application: main.go:4:2: package generateproject/routers is not in GOROOT
go env -w GO111MODULE=on
go mod init name
3、 Cannot generate application code outside of application path
切换到对应项目目录中
4、Failed to build the application: # github.com/mattn/go-sqlite3 cgo: C compiler “gcc” not found: exec: “gcc”: executable file not found in %PATH%
安装MinGW