2017-02-09 73 views
-1

我使用Glide來管理我的golang依賴關係,而是試圖打造一個乾淨的環境,我的項目時,該vendor目錄正在被忽略:滑翔包管理器的使用

./glide install 
[INFO] Downloading dependencies. Please wait... 
[INFO] --> Found desired version locally github.com/dustin/go-humanize 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d! 
[INFO] --> Found desired version locally github.com/jaxxstorm/flexvolume b65378104ef0f49af77d6f73d87da7e78d0f8252! 
[INFO] --> Found desired version locally github.com/kolyshkin/goploop-cli 5365b446a713e31ac4f2026b05a6dac27bbdf21c! 
[INFO] --> Found desired version locally github.com/urfave/cli 0bdeddeeb0f650497d603c4ad7b20cfe685682f6! 
[INFO] Setting references. 
[INFO] --> Setting version for github.com/kolyshkin/goploop-cli to 5365b446a713e31ac4f2026b05a6dac27bbdf21c. 
[INFO] --> Setting version for github.com/dustin/go-humanize to 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d. 
[INFO] --> Setting version for github.com/urfave/cli to 0bdeddeeb0f650497d603c4ad7b20cfe685682f6. 
[INFO] --> Setting version for github.com/jaxxstorm/flexvolume to b65378104ef0f49af77d6f73d87da7e78d0f8252. 
[INFO] Exporting resolved dependencies... 
[INFO] --> Exporting github.com/urfave/cli 
[INFO] --> Exporting github.com/jaxxstorm/flexvolume 
[INFO] --> Exporting github.com/dustin/go-humanize 
[INFO] --> Exporting github.com/kolyshkin/goploop-cli 
[INFO] Replacing existing vendor dependencies 

所有供應商DEPS在那裏

vendor 
└── github.com 
    ├── dustin 
    │   └── go-humanize 
    ├── jaxxstorm 
    │   └── flexvolume 
    ├── kolyshkin 
    │   └── goploop-cli 
    └── urfave 
     └── cli 
      ├── altsrc 
     └── autocomplete 

11目錄

,但我的項目仍然忽略了供應商目錄:

go build -o ploop main.go 
    main.go:4:2: cannot find package "github.com/jaxxstorm/flexvolume" in any of: 
     /usr/lib/golang/src/github.com/jaxxstorm/flexvolume (from $GOROOT) 
     /tmp/go/src/github.com/jaxxstorm/flexvolume (from $GOPATH) 
    main.go:7:2: cannot find package "github.com/kolyshkin/goploop-cli" in any of: 
     /usr/lib/golang/src/github.com/kolyshkin/goploop-cli (from $GOROOT) 
     /tmp/go/src/github.com/kolyshkin/goploop-cli (from $GOPATH) 
    main.go:8:2: cannot find package "github.com/urfave/cli" in any of: 
     /usr/lib/golang/src/github.com/urfave/cli (from $GOROOT) 
     /tmp/go/src/github.com/urfave/cli (from $GOPATH) 

我不認爲我需要設置GOVENDOREXPERIMENT因爲我使用go1.7.4

+0

你不是在構建一個包,而只是構建一個文件。根據其導入路徑或從主包目錄中構建或安裝軟件包。 – JimB

+0

對不起,沒有關注這裏,能否詳細說明一下? – jaxxstorm

+0

在項目中鍵入'go build full/import/path'或只是'go build'。 – JimB

回答

0

很愚蠢真的,git的回購也需要在$GOPATH。我將我的庫存符號鏈接到$GOPATH/src/github.com/vendor/project,一切正常。

+1

不要在你的GOPATH中使用符號鏈接,在很多情況下,編譯工具會忽略符號鏈接,只需按照以下文檔:https://golang.org/doc/code。 HTML – JimB