<p dir="auto">---------- Forwarded message ----------<br>
From: Matt Farina <a href="mailto:matt.farina@gmail.com">matt.farina@gmail.com</a><br>
Date: Fri, Aug 21, 2015 at 3:08 PM<br>
Subject: Re: [golang-dev] go/build and vendor imports<br>
To: golang-dev <a href="mailto:golang-dev@googlegroups.com">golang-dev@googlegroups.com</a><br>
Cc: <a href="mailto:matt.farina@gmail.com">matt.farina@gmail.com</a></p>
<p dir="auto">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 <a href="http://golang.org/src/go/build/build.go?s=15254:15344#L449" rel="nofollow">http://golang.org/src/go/build/build.go?s=15254:15344#L449</a></p>
<p dir="auto">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.</p>
<p dir="auto">On Friday, August 21, 2015 at 2:45:12 PM UTC-4, rsc wrote:<br>
On Fri, Aug 21, 2015 at 1:40 PM, Matt Farina <a href="mailto:matt....@gmail.com">matt....@gmail.com</a> wrote:<br>
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.<br>
Is this a bug? Should the go/build package be able to work with vendor/ imports?</p>
<p dir="auto">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.</p>
<p dir="auto">Was there a particular API in go/build that you think should change behavior for vendored imports?</p>
<p dir="auto">Thanks.<br>
Russ</p>
<h2 dir="auto"></h2>
<p dir="auto">You received this message because you are subscribed to the Google Groups "golang-dev" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:golang-dev+unsubscribe@googlegroups.com">golang-dev+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow">https://groups.google.com/d/optout</a>.</p>
<p dir="auto">Hi,</p>
<p dir="auto">Any chance of goimports being taught about GO15VENDOREXPERIMENT? With go 1.5 it rewrites import paths (to $CWD/vendor/path/to/3rd/party/pkg) even when GO15VENDOREXPERIMENT is set.</p>
<p dir="auto">Thanks<br>
Vlad</p>