doudaotui4297 2015-10-26 20:57
浏览 720

带有绝对路径的golang“不匹配软件包”错误,相对路径很好

I have a tree of golang code. I am using golang 1.5.1 on a Mac (OS X 10.11). I can successfully build my code with the following command with relative paths on the command line.

go install ./...

But, if I use an absolute path, I get an error message. E.g.,

go install `pwd`/...]

warning: "/Users/eben/src/cbq-gui/src/github.com/couchbaselabs/cbq-gui/..." matched no packages

That seems pretty odd, since "." and `pwd` should evaluate to the same thing. What am I missing? Thanks.

  • 写回答

1条回答 默认 最新

  • duanan5940 2015-10-26 21:01
    关注

    pwd will use the full absolute path, but the go tool expects paths relative to $gopath.

    What you really want is go install github.com/couchbaselabs/cbq-gui/... most likely. Assuming your gopath is set to /Users/eben/src/cbq-gui which is a bit odd to me.

    Most people use a single gopath for all their projects.

    评论

报告相同问题?