This is a creation in Article, where the information may have evolved or changed.
GOOS and Goarch reference for each platform
OS ARCH OS Version
Linux 386/amd64/arm >= Linux 2.6
Darwin 386/amd64 OS X (Snow Leopard + Lion)
FreeBSD 386/amd64 >= FreeBSD 7
Windows 386/AMD64 >= Windows 2000
$ cd/usr/local/go/src
$ sudo cgo_enabled=0 goos=linux goarch=amd64./make.bash
This is not to recompile go, because when you install go, you just compile what your local system needs, and cross-platform compilation requires more support for other platforms in go. So, there is./make.bash such a process.
The execution results are similar to the following:
sudo cgo_enabled=0 goos=linux goarch=amd64./make.bash
Password:
Building C Bootstrap tool.
Cmd/dist
Building compilers and Go bootstrap tool for host, Darwin/amd64.
Lib9
Libbio
Libmach
Misc/pprof
Cmd/addr2line
Cmd/cov
Cmd/nm
Cmd/objdump
Cmd/pack
Cmd/prof
cmd/cc
......
Pkg/text/template/parse
Pkg/text/template
Pkg/go/doc
Pkg/go/build
Cmd/go
Pkg/runtime (LINUX/AMD64)
Building packages and commands for host, Darwin/amd64.
Runtime
Errors
Sync/atomic
Unicode
Unicode/utf8
Math
Sync
Unicode/utf16
Crypto/subtle
Io
Syscall
..........
Net/rpc/jsonrpc
Testing/iotest
Testing/quick
Building packages and commands for LINUX/AMD64.
Runtime
Errors
Sync/atomic
Unicode
Unicode/utf8
Math
Sync
Unicode/utf16
........
Testing
Net/rpc/jsonrpc
Testing/iotest
Testing/quick
Installed Go for LINUX/AMD64 In/usr/local/go
Installed Commands In/usr/local/go/bin
Third, compile the executable file under the corresponding platform
To the source code directory to execute:
Cgo_enabled=0 goos=linux goarch=amd64 Go build sina.go
Go build without the preceding parameters simply compiles the executable file that the development environment applies to.
Originally from: http://m.oschina.net/blog/131480