赞
踩
前提是有go环境
go build -o test main.go
-o 参数可以指定输出目录与打包后的文件名,最后生成为test.exe
go get -v && go build报错
go: github.com/spf13/cobra@v0.0.5: Get “https://proxy.golang.org/github.com/spf13/cobra/@v/v0.0.5.mod”: dial tcp 172.217.24.17:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
解决办法:
报错原因是默认使用的是proxy.golang.org,在国内无法访问,换一个国内能访问的代理地址:https://goproxy.cn
执行命令:
go env -w GOPROXY=https://goproxy.cn
再执行命令就可以了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。