2014-05-19 79 views
2

將Herge項目部署到Heroku時,安裝pq軟件包失敗。我已經在heroku buildpack github issues中發佈了這個。使用Heroku上的第三方軟件包進行項目

-----> Running: godep go install -tags heroku ./... 
gournay.go:10:3: cannot find package "github.com/lib/pq" in any of: 
    /app/tmp/cache/go1.2.1/go/src/pkg/github.com/lib/pq (from $GOROOT) 
    /tmp/build_ce268203-801e-4dfc-a56c-d70698d6c5bf/.heroku/g/src/github.com/andyatkinson/gournay/Godeps/_workspace/src/github.com/lib/pq (from $GOPATH) 
    /tmp/build_ce268203-801e-4dfc-a56c-d70698d6c5bf/.heroku/g/src/github.com/lib/pq 
godep: go exit status 1 

go getgo install本地運行如預期:

錯誤在部署時。該項目在本地建立並運行。我相信我的包裝結構是正確的,並且GOPATHGOROOT是正確的。我正在使用godep,它創建了下面的依賴關係文件。 pq包的源代碼似乎被複制到項目中,所以它似乎會從該源代碼編譯。

~/go/src/github.com/andyatkinson/gournay (master) $ cat Godeps/Godeps.json 
{ 
    "ImportPath": "github.com/andyatkinson/gournay", 
    "GoVersion": "go1.2.1", 
    "Deps": [ 
     { 
      "ImportPath": "github.com/lib/pq", 
      "Rev": "c808a1bb644594ca717ac61f71e6b0e454b835e2" 
     } 
    ] 
} 

我錯過了什麼嗎?還有什麼我應該檢查?謝謝!

+0

buildpack支持godep,檢查文檔在https://github.com/tools/godep – nvcnvn

+0

謝謝。我已經在使用godep了。我再次閱讀了自述文件,嘗試重置我的godep依賴項,嘗試了一個不需要的'.godir'文件和其他一些東西,但繼續發生Heroku部署錯誤。 我嘗試了[gopack](https://github.com/d2fn/gopack)作爲godep的解決方法/替代方案,並且我能夠供應依賴關係併成功部署到Heroku。 –

回答

1

您是否在開發中運行godep save

從godep自述:

$ godep save 
This will save a list of dependencies to the file Godeps/Godeps.json, 
and copy their source code into Godeps/_workspace. Read over its 
contents and make sure it looks reasonable. 
Then commit the file to version control. 

--- UPDATE ---

我看到你的回購,最多在Heroku http://warm-depths-3154.herokuapp.com/,請按照下列步驟

rm -Rf gopack.config .godir .gopack 
godep save 
git add --all . // please commit the Godep folder 
git commit -m 'using godep, removed gopack' 

(提交https://github.com/dukex/gournay/commit/0de2390835357879a34ea452a56eeeb6391e5ba8

+0

是的。運行'godep save'後,我運行了'cat Godeps/Godeps.json'並粘貼了上面的輸出。我把gournay項目(https://github.com/andyatkinson/gournay)放在github上,如果你想用godep試試它的話。 –

+0

@AndyAtkinson我更新了答案! – Duke

相關問題