go get 报错 和超时

问题1 -go.mod 为空

go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

以为golang的版本升级问题, go.mod 为NUll 了。 
使用 go env 查看 GOMOD=NUL

进行设置一个路径即可
在go 文件夹下面创建了mod 文件。然后进行执行 
go mod init mod

查看成功,即可成功下载

问题2 -超时

换个代理即可
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
posted @ 2023-01-31 12:18  G0mini  阅读(2133)  评论(0编辑  收藏  举报