Go 交叉编译
最后更新时间:2024-04-07
Go

Windows电脑上编译

  • Linux
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build main.go
  • Mac
SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build main.go

Linux环境编译

  • Windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
  • Mac
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go

Mac电脑上编译

  • Linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
  • Windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go