duannuochi3549 2016-03-22 22:41
浏览 95

Heroku local没有使用我的最新代码。 为什么?

I'm trying to get a very simple database-backed golang heroku app working as a hello world.

The deployed Heroku version of my app is working perfectly, and if I manually test it locally, it works perfectly, but heroku local is stubbornly using an old version of my code. Specifically:

$ heroku local
forego | starting web.1 on port 8080

works, but unexpectedly serves an older version of the app. On the other hand, this:

$ go run web.go

and this:

$ git push heroku master
Everything up-to-date
$ heroku open

both serve what I expect, which is the latest version of my code.

This is really confusing me. I've read all the documentation and double checked the state of everything, and can't find anything that indicates what is going on, or which could cause it.

My best guess are that heroku local is using a compiled slug from somewhere that is not getting updated.

  • 写回答

1条回答 默认 最新

  • douzhuochao4027 2016-03-22 22:50
    关注

    The problem is that golang is a compiled language, and heroku local just uses the last build and does not initiate the rebuild on its own. The fix is to simply remember to compile before running heroku local:

    $ go install
    

    It is easy to forget this if you use go run web.go for testing, because that doesn't need a recompile, and heroku itself automatically does the build, so you could get away with never running go install until you try to use heroku local.

    (I actually figured this out as soon as I had the whole question written out, but I figured I should post anyways for future reference.)

    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试