This is a creation in Article, where the information may have evolved or changed.
Specify Fork Compilation target:
Goarch processor architecture for Target platform (compiled target platform) (386, AMD64, ARM)
Operating system for GOOS target platform (compiled target platform) (Darwin, FreeBSD, Linux, Windows)
(i) Linux 64-bit executable program under Windows compilation:
SET CGO_ENABLED=0 //不设置也可以,原因不明 SET GOOS=linux SET GOARCH=amd64 通过 go env 查看设置是否成功。
(ii) Linux compiled Windows executable program:
export CGO_ENABLED=0 export GOOS=windows export GOARCH=amd64 通过 go env 查看设置是否成功。 go build hello.go
Reference: http://blog.csdn.net/panshiqu/article/details/53788067
Problem:
The above (one) method setting can only take effect in the current window, and then search out other methods, but unsuccessful.
SET CGO_ENABLED=0 SET GOOS=linuxSET GOARCH=amd64make.bat
Error:
Solve:
Set the environment variable GOROOT_BOOTSTRAP to the Go installation directory C:\Go
Run Make.bat Error again:
GitHub has explained that: not the source code compiled to install the go, re-source installation go can solve
Problem:
$ go Get github.com/gorilla/websocket
Error:
As shown in the Make.bat
Solve:
Reinstall Go,https://storage.googleapis.com/golang/go1.8.3.windows-amd64.zip