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.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With