部署Go Web应用到Heroku:找不到包的问题

huangapple go评论81阅读模式
英文:

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 installgo install是正常的。

这是我的go目录结构(简化版):

  • src
    • testapp
      • main.go
    • github.com
      • codegangsta
      • russross
      • blackfriday

谢谢。

英文:

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

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.

huangapple
  • 本文由 发表于 2015年1月12日 04:53:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/27891968.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定