Mac中使用Goland交叉编译成Windows可执行程序

在Run/Debug Configuration中添加环境变量配置:
CGO_ENABLED=0;GOOS=windows;GOARCH=amd64
注意不能用空格替代分号,不能写成CGO_ENABLED=0 GOOS=windows GOARCH=amd64
如下图:
Mac中使用Goland交叉编译成Windows可执行程序
Mac中使用Goland交叉编译成Windows可执行程序