golang交叉编译

Windows主机编译Linux,MAC客户端

Windows主机编译Windows客户端

SET CGO_ENABLED=0
SET GOOS=windows
SET GOARCH=amd64
go build -o client-windows.exe main.go

Windows主机编译LINUX客户端

SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build -o client-linux main.go

Windows主机编译MAC客户端

SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build -o client-mac main.go

Linux主机编译Widows,MAC客户端

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o client-linux main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o client-mac main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o client-windows.exe main.go

MAC主机编译Widows,linux客户端

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o client-linux main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o client-mac main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o client-windows.exe main.go

发表评论