I am using http://github.com/tmthrgd/go-bindata to embed static files and templates within Go executable file. It requires to run go generate to run a Go code that read each file and write binary representation as standard go file. go generate have to be fired before build process.
Is there a chance to configure Heroku to handle this?
如何在Heroku上运行go generate
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
dongzhi2887 2017-08-27 16:47关注go generateshould be run locally while developing, not on heroku. If you run it on heroku it will lead to very hard to debug issues. Ifgo generatehas unexpected results you wont be able to easily inspect this.You could run
go generatewith a tool like modd or with a git hook. Having the results ofgo generatetracked by git also means that you can track which changes affected generated code.In a language like ruby it might be customary to run
bundle installon the server and omit dependencies from git. For go programs this is not so. Dependencies should be vendored and tracked by git. Same for generated code.The rest is not at all advised for this case and I would never do something like this.
- fork the go heroku buildpack
- add a line to run
go generate - use your modified go heroku buildpack
- deploy your app
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报