windows下通过go编译linux程序
set GOARCH=amd64 set GOOS=linux go build
go build时可能报错:
go: golang.org/x/[email protected]: Get “https://proxy.golang.org/golang.org/x/net/@v/v0.0.0-20201031054903-ff519b6c9102.mod”: dial tcp 172.217.160.113: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.
需要执行命令:
go env -w GOPROXY=https://goproxy.cn
再次 go build