1. WINDOWS 下
set CGO_ENABLED=0
set GOOS=linux
set GOARCH=amd64
go build -o test.exe test.go
set CGO_ENABLED=0
set GOOS=darwin
set GOARCH=amd64
go build -o test.exe test.go
set GOOS=windows
go build -o test.exe test.go
2. MAC 下
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o test.exe test.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test.exe test.go
3. LINUX 下
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o test.exe test.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o test.exe test.go