英文:
Run Go app on Heroku
问题
我正在尝试按照https://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku上的教程操作。最初似乎一切正常:
ceiroa-ltm:my_heroku_app ceiroa$ heroku create -b https://github.com/kr/heroku-buildpack-go.git
创建glacial-badlands-6720...完成,堆栈为cedar-14
BUILDPACK_URL=https://github.com/kr/heroku-buildpack-go.git
https://glacial-badlands-6720.herokuapp.com/ | https://git.heroku.com/glacial-badlands-6720.git
添加了Git远程heroku
ceiroa-ltm:my_heroku_app ceiroa$ git push heroku master
计数对象:10,完成。
使用最多4个线程进行增量压缩。
正在压缩对象:100%(6/6),完成。
正在写入对象:100%(10/10),925字节| 0字节/秒,完成。
总共10个(增量0个),重用0个(增量0个)
远程:正在压缩源文件...完成。
远程:正在构建源码:
远程:
远程:----->获取自定义git构建包...完成
远程:----->检测到Go应用程序
远程:----->安装go1.3.3...完成
远程:----->运行:godep go install -tags heroku ./...
远程:----->发现进程类型
远程:
远程:----->压缩...完成,1.5MB
远程:----->启动...完成,v4
远程:https://glacial-badlands-6720.herokuapp.com/部署到Heroku
远程:
远程:验证部署...完成。
To https://git.heroku.com/glacial-badlands-6720.git
- [new branch] master -> master
然而,没有启动任何dynos:
ceiroa-ltm:my_heroku_app ceiroa$ heroku ps
ceiroa-ltm:my_heroku_app ceiroa$
并且应用程序出现错误:
我做错了什么?
英文:
I'm trying to follow the tutorial at https://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku. Initially everything seems to work:
ceiroa-ltm:my_heroku_app ceiroa$ heroku create -b https://github.com/kr/heroku-buildpack-go.git
Creating glacial-badlands-6720... done, stack is cedar-14
BUILDPACK_URL=https://github.com/kr/heroku-buildpack-go.git
https://glacial-badlands-6720.herokuapp.com/ | https://git.heroku.com/glacial-badlands-6720.git
Git remote heroku added
ceiroa-ltm:my_heroku_app ceiroa$ git push heroku master
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (10/10), 925 bytes | 0 bytes/s, done.
Total 10 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Go app detected
remote: -----> Installing go1.3.3... done
remote: -----> Running: godep go install -tags heroku ./...
remote: -----> Discovering process types
remote:
remote: -----> Compressing... done, 1.5MB
remote: -----> Launching... done, v4
remote: https://glacial-badlands-6720.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/glacial-badlands-6720.git
* [new branch] master -> master
However, no dynos are spinned:
ceiroa-ltm:my_heroku_app ceiroa$ heroku ps
ceiroa-ltm:my_heroku_app ceiroa$
And the app gives an error:
What am I doing wrong?
答案1
得分: 0
我尝试了很多方法都没有成功:
- 降级Go版本(与https://github.com/kr/go-heroku-example/blob/master/Godeps/Godeps.json中定义的版本匹配)
- 将默认的Eclipse Go结构改为项目内没有src、bin或pkg文件夹的结构
- 在项目名称、Procfile和Godeps.json中使用连字符而不是下划线
- 在Godeps.json中定义完整的标识符
最后,我从头开始,而不是从Eclipse中创建项目,通过命令行创建项目,这样就成功了。
根据上述情况,我可以排除#1和#4作为解决方法,因为我回到了最初的配置。
另一件让我困惑的事情是不同网站和帖子中对“.godir”的引用。我不知道这个文件以前是用来做什么的,但现在似乎不再需要了。
暂时我认为Eclipse及其Go插件是问题的原因。
英文:
I tried a bunch of things that didn't work:
- downgrade go version (to match the one defined in https://github.com/kr/go-heroku-example/blob/master/Godeps/Godeps.json)
- move from default Eclipse Go structure to one without src, bin, or pkg inside project
- use hyphens instead of underscores (for project name and in Procfile and Godeps.json)
- define full identifier in Godeps.json
At the end and started from scratch again, creating the project from the command line instead of from Eclipse, and this worked.
From the things above, I can rule out #1 and #4 as fixes, as I'm back to using the same config I initially had.
Another thing that was throwing me off was references to ".godir" in different websites and posts. I don't know what this file used to be used for, but it doesn't seem necessary any more.
I'm going to point to Eclipse and its Go plugin as the culprits, for now.
答案2
得分: 0
英文:
Heroku now officially supports Go and has a Getting Started guide.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论