1

你如何修复空包路径错误?我不清楚哪个包有问题或如何解决。

vendor/vendor.jsonjson 文件。

{
    "comment": "",
    "heroku": {
        "goVersion": "go1.6",
        "install": [
            "."
        ]
    },
    "ignore": "test",
    "package": [
        {
            "path": "context",
            "revision": ""
        },
        {
            "checksumSHA1": "eJQuyvuWx82bVvH0+b7a1AOQGqs=",
            "path": "github.com/ChimeraCoder/anaconda",
            "revision": "00ecb7b4510497dc28cd46a598007ab8fe01f889",
            "revisionTime": "2016-06-04T23:38:44Z"
        },
        {
            "checksumSHA1": "xE9Zo5ubzdEVBeRf+yD/ZjLALHk=",
            "path": "github.com/ChimeraCoder/tokenbucket",
            "revision": "c5a927568de7aad8a58127d80bcd36ca4e71e454",
            "revisionTime": "2013-12-01T22:36:12Z"
        },
        {
            "checksumSHA1": "3RgReu+42CU1EQ6afDsVSvBuPyk=",
            "path": "github.com/azr/backoff",
            "revision": "53511d3c733003985b0b76f733df1f4d0095ee6a",
            "revisionTime": "2016-01-15T11:51:03Z"
        },
        {
            "checksumSHA1": "bO0ErJXuVJ7s7DS4AJlN55op8cM=",
            "path": "github.com/dghubble/oauth1",
            "revision": "d9f485600d309576dfa9764424f537e1f254d9a1",
            "revisionTime": "2016-08-21T06:27:25Z"
        },
        {
            "checksumSHA1": "ycg56E+pTPAHToKMIj8C5SZ+WYQ=",
            "path": "github.com/dustin/go-jsonpointer",
            "revision": "ba0abeacc3dcca5b9b20f31509c46794edbc9965",
            "revisionTime": "2016-08-14T07:29:49Z"
        },
        {
            "checksumSHA1": "2138MttIW/b+UkA4YMYcTc6yzOU=",
            "path": "github.com/dustin/gojson",
            "revision": "2e71ec9dd5adce3b168cd0dbde03b5cc04951c30",
            "revisionTime": "2016-03-07T16:12:27Z"
        },
        {
            "checksumSHA1": "PYBCaIzh3RFkxtkkP8x4XCEYLCg=",
            "path": "github.com/garyburd/go-oauth/oauth",
            "revision": "719b069913e1151a73ea30d2ea4f90deda3ce234",
            "revisionTime": "2016-04-12T16:13:20Z"
        },
        {
            "checksumSHA1": "mOUDsWfYLlh8f6ekwyIUo3+4xJI=",
            "path": "goji.io",
            "revision": "e355964ac565b94cf0fc7f218346626529125086",
            "revisionTime": "2016-05-07T21:13:57Z"
        },
        {
            "checksumSHA1": "Jf3C/refSMB2wVYGp1pssKXVNcI=",
            "path": "goji.io/internal",
            "revision": "e355964ac565b94cf0fc7f218346626529125086",
            "revisionTime": "2016-05-07T21:13:57Z"
        },
        {
            "checksumSHA1": "gHp/Mv7vgZWs7iq/F0YHnWgEotQ=",
            "path": "goji.io/pat",
            "revision": "e355964ac565b94cf0fc7f218346626529125086",
            "revisionTime": "2016-05-07T21:13:57Z"
        },
        {
            "checksumSHA1": "z2zVlHamw4ufyuSaf49reuusrmg=",
            "path": "goji.io/pattern",
            "revision": "e355964ac565b94cf0fc7f218346626529125086",
            "revisionTime": "2016-05-07T21:13:57Z"
        },
        {
            "checksumSHA1": "9jjO5GjLa0XF/nfWihF02RoH4qc=",
            "path": "golang.org/x/net/context",
            "revision": "6c89f9617983ee917132513a791d8b5850fe90c5",
            "revisionTime": "2016-08-24T21:03:21Z"
        }
    ],
    "rootPath": "thinkwire.com/thw1"
}

完整的堆栈跟踪。

$ govendor fetch lib/pq
panic: Empty package path

goroutine 1 [running]:
panic(0x4b9c20, 0xc8200123e0)
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
github.com/kardianos/govendor/context.(*Context).setPackage(0xc820122000, 0xc820326420, 0x26, 0xc82029d5a0, 0x0, 0xc82029d5a0, 0x0, 0xc820112060, 0x26, 0x10201, ...)
    $GOPATH/src/github.com/kardianos/govendor/context/resolve.go:335 +0x8ba
github.com/kardianos/govendor/context.(*Context).addSingleImport(0xc820122000, 0xc8203189c0, 0x2b, 0xc82029d5a0, 0x0, 0x0, 0x0, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/resolve.go:383 +0x457
github.com/kardianos/govendor/context.(*Context).addFileImports(0xc820122000, 0xc8203189c0, 0x30, 0xc820118080, 0x15, 0x27, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/resolve.go:251 +0x13e8
github.com/kardianos/govendor/context.(*Context).loadPackage.func1(0xc8203189c0, 0x30, 0xda5950, 0xc820312820, 0x0, 0x0, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/resolve.go:55 +0x150
github.com/kardianos/govendor/internal/vfilepath.walk(0xc8203189c0, 0x30, 0xda5950, 0xc820312820, 0xc820118780, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/internal/vfilepath/walk.go:19 +0x80
github.com/kardianos/govendor/internal/vfilepath.walk(0xc8203188a0, 0x2a, 0xda5950, 0xc820312680, 0xc820118780, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/internal/vfilepath/walk.go:44 +0x4f5
github.com/kardianos/govendor/internal/vfilepath.walk(0xc820112990, 0x27, 0xda5950, 0xc820134680, 0xc820118780, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/internal/vfilepath/walk.go:44 +0x4f5
github.com/kardianos/govendor/internal/vfilepath.Walk(0xc820112990, 0x27, 0xc820118780, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/internal/vfilepath/walk.go:82 +0xe1
github.com/kardianos/govendor/context.(*Context).loadPackage(0xc820122000, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/resolve.go:72 +0x19a
github.com/kardianos/govendor/context.(*Context).modify(0xc820122000, 0xc820120140, 0x7fff5fbff804, 0xc8200f77e5, 0x0, 0x3, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/modify.go:232 +0xfcf
github.com/kardianos/govendor/context.(*Context).ModifyImport(0xc820122000, 0xc820120140, 0xc82000a204, 0xc8200f77e5, 0x0, 0x3, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/context/modify.go:183 +0x23b
github.com/kardianos/govendor/run.(*runner).Modify(0xc8200f7d50, 0xda51c0, 0xc82002a010, 0xc82000a260, 0x1, 0x1, 0x81de04, 0xda5808, 0xc8200f7db7, 0x12ec8, ...)
    $GOPATH/src/github.com/kardianos/govendor/run/modify.go:105 +0x9e7
github.com/kardianos/govendor/run.(*runner).run(0xc8200f7d50, 0xda51c0, 0xc82002a010, 0xc82000a240, 0x3, 0x3, 0xda5808, 0xc8200f7db7, 0xda5808, 0x0, ...)
    $GOPATH/src/github.com/kardianos/govendor/run/run.go:83 +0x662
github.com/kardianos/govendor/run.Run(0xda51c0, 0xc82002a010, 0xc82000a240, 0x3, 0x3, 0xda5808, 0xc8200f7db7, 0x0, 0x0, 0x0)
    $GOPATH/src/github.com/kardianos/govendor/run/run.go:41 +0x95
main.main()
    $GOPATH/src/github.com/kardianos/govendor/main.go:35 +0x453
4

1 回答 1

2

我想到了。问题是我在项目中以中间状态保存了一个文件。

package whatever

import (
    ""
)

govendor抱怨进口声明是空的。

于 2016-09-05T16:03:52.500 回答