go get xxx报错
go: go.mod file not found in current directory or any parent directory.
1.打开终端配置开启mod:
go env -w GO111MODULE=on
2.在项目初始化mod目录xxx(新项目名称),(用echo为例)
go mod init echo
3.获取安装(安装echo为例)
go get github.com/labstack/echo/v4
mod的help命令可以看具体的意义:
#go mod help The commands are: download download modules to local cache edit edit go.mod from tools or scripts graph print module requirement graph init initialize new module in current directory tidy add missing and remove unused modules vendor make vendored copy of dependencies verify verify dependencies have expected content why explain why packages or modules are needed