douman6679 2017-08-27 16:41
浏览 49
已采纳

如何在Heroku上运行go generate

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?

  • 写回答

1条回答 默认 最新

  • dongzhi2887 2017-08-27 16:47
    关注

    go generate should be run locally while developing, not on heroku. If you run it on heroku it will lead to very hard to debug issues. If go generate has unexpected results you wont be able to easily inspect this.

    You could run go generate with a tool like modd or with a git hook. Having the results of go generate tracked 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 install on 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

    around this line

    more on buildpacks

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)