我正在嘗試使用Go Buildpack在 Heroku 上放置一個 Go 應用程序,當它是基本的東西時這很好,但是一旦我做一個本地包,它就不會編譯。這是一個示例設置:結構+ship +foo foo.go main.gomain.gopackage mainimport ( "os" "fmt" "net/http" "ship/foo")func main() { foo.Bar() port := os.Getenv("PORT") http.HandleFunc("/", root) http.ListenAndServe(":" + port, nil)}func root(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Aloha, world!")}foo.gopackage foofunc Bar() {}推git push heroku masterInitializing repository, done.Counting objects: 20, done.Delta compression using up to 8 threads.Compressing objects: 100% (13/13), done.Writing objects: 100% (20/20), 1.53 MiB | 586.00 KiB/s, done.Total 20 (delta 2), reused 0 (delta 0)-----> Fetching custom git buildpack... done-----> Go app detected-----> Installing go1.3.1... done-----> Running: godep go install -tags heroku ./...main.go:7:3: cannot find package "ship/foo" in any of: /app/tmp/cache/go1.3.1/go/src/pkg/ship/foo (from $GOROOT) /tmp/build_4b92e51c-3959-4ddb-8eff-90d72da70729/.heroku/g/src/_/Users/Daryl/Go/src/ship/Godeps/_workspace/src/ship/foo (from $GOPATH) /tmp/build_4b92e51c-3959-4ddb-8eff-90d72da70729/.heroku/g/src/ship/foogodep: go exit status 1 ! Push rejected, failed to compile Go app知道這里發(fā)生了什么以及如何去做嗎?
2 回答

慕斯王
TA貢獻1864條經(jīng)驗 獲得超2個贊
我有一個對我有用的解決方案,雖然我不喜歡它,但希望這不是正確的方法!
我正在使用供應商。本地和 TravisCI 都能夠構建我的應用程序,但 TravisCI 無法將其部署到 Heroku,因為 Heroku 也無法找到本地包。我最終做的是通過供應商獲取本地包:
govendor fetch +local
一旦我再次提交,TravisCI 構建并部署到 Heroku,我的應用程序就可以運行了。
我不喜歡這個解決方案的原因是我現(xiàn)在有重復的代碼!我的本地子包可以在 / 以及供應商中找到:/vendor/
- 2 回答
- 0 關注
- 195 瀏覽
添加回答
舉報
0/150
提交
取消