On Saturday, December 3, 2016 at 6:25:34 PM UTC+8, Peter Mogensen wrote: > > > > On 2016-12-02 22:31, Ian Lance Taylor wrote: > > On Fri, Dec 2, 2016 at 11:24 AM, gd <di...@veryhaha.com <javascript:>> > wrote: > >> It looks, for the official compiler, if the main package is under > GOPATH, > >> then the order is: > >> 1. the vendor folder > >> 2. the standard packages > >> 3. GOPATH folder > >> > >> If the main package is outsides of GOPATH, then the order is: > >> 1. the standard packages > >> 2. GOPATH folder > >> the local vendor folder is totally ignored. > >> > >> I don't know if this is the well defined behaviour or not. > > > > You can see the defined behavior by running `go help gopath`. That > > will tell you the search path when using the go tool. > > Maybe I read the help text wrong, but it doesn't really answer the above > question does it? > > In general it seems using "go build" in the project dir ignores the > vendor folder if the project dir is not under "src" in the GOPATH. Even > if there's code in the project dir and a vendor folder. > > So... assuming this (and GOPATH=$PWD): > > $ tree > . > ├── main.go > ├── src > │ └── myapp -> .. > └── vendor > ├── github.com > │ └── pkg > │ └── errors > │ ├── appveyor.yml > │ ├── bench_test.go > │ ├── errors.go > │ ├── errors_test.go > │ ├── example_test.go > │ ├── format_test.go > │ ├── LICENSE > │ ├── README.md > │ ├── stack.go > │ └── stack_test.go > └── manifest > > Executing "go build" in the top directory ignores the vendor folder. > But exexuting "go build myapp" works and includes the vendor folder. > > /Peter >
You mean myapp can import the packages in the vendor folder? I tested it, but without success. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.