我想在Heroku上部署Go应用程序,但遇到了如下错误:
remote: -----> Go app detected
remote: -----> Checking Godeps/Godeps.json file.
remote: -----> Using go1.6.3
remote: !! Installing package '.' (default)
remote: !!
remote: !!
remote: -----> Running: go install -v -tags heroku .
remote: main.go:9:2: cannot find package "github.com/go-martini/martini" in any of:
remote: /app/tmp/cache/go1.6.3/go/src/github.com/go-martini/martini (from $GOROOT)
remote: /tmp/build_3c0222e075a91a3363e590a0169d6fb6/.heroku/go/src/github.com/go-martini/martini (from $GOPATH)它适用于我的本地环境,我使用godeps save命令将依赖项添加到godeps save中。有什么问题吗?我注意到正式的开始-开始回购有vendor文件夹,所以这是否意味着我必须将所有依赖项都放到我的存储库中?
这是我的Godeps/Godeps.json
{
"ImportPath": "github.com/mikamikuh/oauth2-server-tester",
"GoVersion": "go1.6",
"GodepVersion": "v74",
"Deps": [
{
"ImportPath": "github.com/codegangsta/inject",
"Comment": "v1.0-rc1-10-g33e0aa1",
"Rev": "33e0aa1cb7c019ccc3fbe049a8262a6403d30504"
},
{
"ImportPath": "github.com/go-martini/martini",
"Comment": "v1.0-185-gc257c41",
"Rev": "c257c412d547ac70fcaf5596c1a50a7cb832c1fc"
}
]
}发布于 2016-08-14 08:30:48
是的,您确实需要将所有依赖项都包含到存储库中。
实际上,当您运行godep save ./...并使用go 1.5或更高版本时,Godep将自动将依赖项放在名为vendor的目录中(在您的repo的根目录中)。您需要将Godep和供应商目录提交到存储库中。
另外,请注意,在添加供应商目录时,请使用-f标志添加其中的所有文件。它是需要的,因为某些文件/目录可能不会提交,这取决于您的gitignore文件,这将导致heroku中的构建失败。作为一种标准做法,您可以在使用godep添加依赖项之后,将以下命令导出。
git添加-f供应商/ Godep/ git提交-a -m“供应商依赖关系”
https://stackoverflow.com/questions/38933957
复制相似问题