What are the values of goos and goarch,Can search online,A lot ofīut cross-compilation does not support cgo, which means that if you have c code in your code, you cannot compile it.For example, if your program uses a sqlite database, compiling the go-sqlite driver according to the above method will fail. Set cgo_enabled=0 set goos=linux set goarch=amd64 go build main.go Set cgo_enabled=0 set goos=darwin set goarch=amd64 go build main.go Binary files for golang cross compilation platformĪnyone familiar with golang knows,golang cross compilation is simple,Just set a few environment variables #compile linux and windows binary on macĬgo_enabled=0 goos=linux goarch=amd64 go buildĬgo_enabled=0 goos=windows goarch=amd64 go buildĬgo_enabled=0 goos=darwin goarch=amd64 go build
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |