go/loader: use build.AllowVendor during Import on Go 1.6 and later
Makes programs like ssadump work on packages using vendored code, for example net/http. For golang/go#12278. Depends on CL 17726 in main repository. Change-Id: Ibabf564e397044a0f449087124dd96161081baaf Reviewed-on: https://go-review.googlesource.com/17727 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
1cdaff4a02
commit
34ae141ecc
|
@ -458,8 +458,9 @@ func (conf *Config) Load() (*Program, error) {
|
|||
conf.FindPackage = func(ctxt *build.Context, path string) (*build.Package, error) {
|
||||
// TODO(adonovan): cache calls to build.Import
|
||||
// so we don't do it three times per test package.
|
||||
// (Note that this is difficult due to vendoring.)
|
||||
ioLimit <- true
|
||||
bp, err := ctxt.Import(path, conf.Cwd, 0)
|
||||
bp, err := ctxt.Import(path, conf.Cwd, importMode)
|
||||
<-ioLimit
|
||||
if _, ok := err.(*build.NoGoError); ok {
|
||||
return bp, nil // empty directory is not an error
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !go1.6
|
||||
|
||||
package loader
|
||||
|
||||
import "go/build"
|
||||
|
||||
var importMode build.ImportMode = 0
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.6
|
||||
|
||||
package loader
|
||||
|
||||
import "go/build"
|
||||
|
||||
var importMode build.ImportMode = build.AllowVendor
|
Loading…
Reference in New Issue