英文:
Deploying go webapps to heroku: can't find package issue
问题
我正在遵循这个教程并尝试将一个简单的Go Web应用部署到Heroku,但是在解决一个错误时遇到了困难:
remote: -----> Running: godep go install -tags heroku ./...
remote: main.go:7:3: cannot find package "github.com/russross/blackfriday" in any of:
remote: /app/tmp/cache/go1.3.3/go/src/pkg/github.com/russross/blackfriday (from $GOROOT)
remote: /tmp/build_1a204a91c152b49fe234bde14529ad27/.heroku/g/src/bitbucket.gotest/Godeps/_workspace/src/github.com/russross/blackfriday (from $GOPATH)
remote: /tmp/build_1a204a91c152b49fe234bde14529ad27/.heroku/g/src/github.com/russross/blackfriday
remote: godep: go exit status 1
remote:
remote: ! Push rejected, failed to compile Go app
我对Go还不熟悉,所以我猜我可能搞错了我的包结构,但是运行$GOPATH/bin/godep go install
或go install
是正常的。
这是我的go目录结构(简化版):
- src
- testapp
- main.go
- github.com
- codegangsta
- russross
- blackfriday
- testapp
谢谢。
英文:
I'm following this tutorial and attempting to deploy a bare-bones Go web app to Heroku, but am having difficulties resolving an error:
remote: -----> Running: godep go install -tags heroku ./...
remote: main.go:7:3: cannot find package "github.com/russross/blackfriday" in any of:
remote: /app/tmp/cache/go1.3.3/go/src/pkg/github.com/russross/blackfriday (from $GOROOT)
remote: /tmp/build_1a204a91c152b49fe234bde14529ad27/.heroku/g/src/bitbucket.gotest/Godeps/_workspace/src/github.com/russross/blackfriday (from $GOPATH)
remote: /tmp/build_1a204a91c152b49fe234bde14529ad27/.heroku/g/src/github.com/russross/blackfriday
remote: godep: go exit status 1
remote:
remote: ! Push rejected, failed to compile Go app
I'm new to Go, so I assume I've screwed up my package structure, but running $GOPATH/bin/godep go install
or go install
works fine.
Here's the (abbreviated) structure of my go directory:
- src
- testapp
- main.go
- github.com
-codegangsta- russross
- blackfriday
- testapp
Thanks.
答案1
得分: 2
通过将我的$GOPATH/bin
目录添加到我的路径中解决了这个问题。
export PATH=$PATH:$GOPATH/bin
不过,我很好奇为什么需要这样做。
英文:
Fixed the issue by adding my $GOPATH/bin
dir to my path.
export PATH=$PATH:$GOPATH/bin
Curious as to why this was necessary, though.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论