If I have a package in my GOPATH go/build.Import works for it. If the package is in the vendor/ directory it doesn't and I wasn't sure the best way to make a vendor/ directory work with go/build. Any pointers would be appreciated.
On Friday, August 21, 2015 at 2:45:12 PM UTC-4, rsc wrote:
On Fri, Aug 21, 2015 at 1:40 PM, Matt Farina matt....@gmail.com wrote:
I noticed the go/build package doesn't work with vendor/ imports. The vendor code was kept in in the go cmd codebase which, I don't think, is available for packages.
Is this a bug? Should the go/build package be able to work with vendor/ imports?
go/build does not know about source code layout, directories, and the like. It just reports what is contained in a set of specified files. In particular, it does not resolve imports. It doesn't tell you whether an imported package exists, for example.
Was there a particular API in go/build that you think should change behavior for vendored imports?
---------- Forwarded message ----------
From: Matt Farina matt.farina@gmail.com
Date: Fri, Aug 21, 2015 at 3:08 PM
Subject: Re: [golang-dev] go/build and vendor imports
To: golang-dev golang-dev@googlegroups.com
Cc: matt.farina@gmail.com
The Import method on Context (available as go/build.Import() under a default confit) knows about the goroot and gopath when trying to resolve packages. See http://golang.org/src/go/build/build.go?s=15254:15344#L449
If I have a package in my GOPATH go/build.Import works for it. If the package is in the vendor/ directory it doesn't and I wasn't sure the best way to make a vendor/ directory work with go/build. Any pointers would be appreciated.
On Friday, August 21, 2015 at 2:45:12 PM UTC-4, rsc wrote:
On Fri, Aug 21, 2015 at 1:40 PM, Matt Farina matt....@gmail.com wrote:
I noticed the go/build package doesn't work with vendor/ imports. The vendor code was kept in in the go cmd codebase which, I don't think, is available for packages.
Is this a bug? Should the go/build package be able to work with vendor/ imports?
go/build does not know about source code layout, directories, and the like. It just reports what is contained in a set of specified files. In particular, it does not resolve imports. It doesn't tell you whether an imported package exists, for example.
Was there a particular API in go/build that you think should change behavior for vendored imports?
Thanks.
Russ
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The text was updated successfully, but these errors were encountered: