dqsk4643 2016-11-02 09:49
浏览 45
已采纳

无法在Heroku上部署具有Godeps依赖项的Go应用

I have the following error when i'm trying to push my project on heroku

git push heroku master
Counting objects: 88, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (86/86), done.
Writing objects: 100% (88/88), 18.85 MiB | 686.00 KiB/s, done.
Total 88 (delta 13), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Checking Godeps/Godeps.json file.
remote: -----> Using go1.7.3
remote: -----> Running: go install -v -tags heroku ./...
remote: main.go:8:2: cannot find package "github.com/Sirupsen/logrus" in any of:
remote:         /app/tmp/cache/go1.7.3/go/src/github.com/Sirupsen/logrus (from $GOROOT)
remote:         /tmp/tmp.Ffkjp5c5US/.go/src/github.com/Sirupsen/logrus (from $GOPATH)
remote: main.go:6:2: cannot find package "github.com/gin-gonic/gin" in any of:
remote:         /app/tmp/cache/go1.7.3/go/src/github.com/gin-gonic/gin (from $GOROOT)
remote:         /tmp/tmp.Ffkjp5c5US/.go/src/github.com/gin-gonic/gin (from $GOPATH)
remote:  !     Push rejected, failed to compile Go app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to eerie-wizard-18479.
remote:
To https://git.heroku.com/eerie-wizard-18479.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/eerie-wizard-18479.git'

I carefully made a godep save ./... before commiting and pushing on heroku, this is my Godeps.json file: (logrus and gin are present in this file)

{
    "ImportPath": "github.com/sbouaked/neo-fundations",
    "GoVersion": "go1.7",
    "GodepVersion": "v74",
    "Packages": [
        "./..."
    ],
    "Deps": [
        {
            "ImportPath": "github.com/Sirupsen/logrus",
            "Comment": "v0.10.0-38-g3ec0642",
            "Rev": "3ec0642a7fb6488f65b06f9040adc67e3990296a"
        },
        {
            "ImportPath": "github.com/gin-gonic/gin",
            "Comment": "v1.0-2-g3900df0",
            "Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
        },
        {
            "ImportPath": "github.com/gin-gonic/gin/binding",
            "Comment": "v1.0-2-g3900df0",
            "Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
        },
        {
            "ImportPath": "github.com/gin-gonic/gin/render",
            "Comment": "v1.0-2-g3900df0",
            "Rev": "3900df04d2a88e22beaf6a2970c63648b9e1b0e1"
        },
        {
            "ImportPath": "github.com/golang/protobuf/proto",
            "Rev": "98fa357170587e470c5f27d3c3ea0947b71eb455"
        },
        {
            "ImportPath": "github.com/manucorporat/sse",
            "Rev": "ee05b128a739a0fb76c7ebd3ae4810c1de808d6d"
        },
        {
            "ImportPath": "golang.org/x/net/context",
            "Rev": "4bb47a1098b37d69980d96237e2ae4ff56bb5a95"
        },
        {
            "ImportPath": "golang.org/x/sys/unix",
            "Rev": "c200b10b5d5e122be351b67af224adc6128af5bf"
        },
        {
            "ImportPath": "gopkg.in/go-playground/validator.v8",
            "Comment": "v8.18.1",
            "Rev": "5f57d2222ad794d0dffb07e664ea05e2ee07d60c"
        },
        {
            "ImportPath": "gopkg.in/yaml.v2",
            "Rev": "a5b47d31c556af34a302ce5d659e6fea44d90de0"
        }
    ]
}

I saw on this post that I have to commit vendor/, but I didn't want to. There is really any solutions for this now ?

  • 写回答

1条回答 默认 最新

  • duangu6431 2016-11-04 00:49
    关注

    If you look at the heroku buildpack for Go (https://github.com/heroku/heroku-buildpack-go/blob/master/bin/compile), it does not currently support GoDeps, as traditional GoDeps style dependency management has been deprecated as Go v1.6. You can convert your GoDeps dependencies to a vendored dependency and that should fix that.

    I personally recommend using glide: https://github.com/Masterminds/glide

    But you can also use:

    https://github.com/kardianos/govendor

    or

    https://github.com/constabulary/gb

    As those are supported in the compile script for the buildpack.

    Each of those support an automated conversion of GoDeps to their formats.

    If you have ./vendor/vendor.json Heroku will automatically use govendor, unless you configure Heroku to use something otherwise.

    This page may help as well https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-go

    It does support Godep, technically, but it would seem you have to either use an older version of Go or move GoDeps to vendor.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?