douzhang3356 2016-01-29 14:20
浏览 72

Windows上Mac上的golang交叉编译

I am writing a go program to parse csv files and upload them to a postgres database in the Heroku cloud. The program works fine on my mac laptop. Eventual target platform for deploying the code is Windows though. I did some research and found that the following command creates a Windows executable on my Mac.

 env GOOS=windows GOARCH=386 go build -v main.go

This produced an executable called main.exe when I had just one file called main.go. The program has grown since then and I have it now split into three source files:

main.go
common.go
specific.go

They are all in the same source directory though. Moreover, since the program is relatively small, I have all functions in the 'main' package. What is the command now to cross-compile on mac for windows for multiple source files belonging to the same package? The previous command did not work since the other two file common.go and specific.go are not included. Also, I would like to know how to rename the Windows 'exe' file to something else than main.exe, e.g., upload.exe? I am using go version go1.5 darwin/amd64

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分