Skip to content

Commit

Permalink
Falling back to the old solution on error, due to the fact that types…
Browse files Browse the repository at this point in the history
….Importer does not support locally vendored packages
  • Loading branch information
Lars Gohr committed Aug 7, 2018
1 parent bbf96a5 commit 84a26bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locator/locator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/maxbrunsfeld/counterfeiter/model"
"go/build"
"path"
)

func GetInterfaceFromFilePath(interfaceName, filePath string) (*model.InterfaceToFake, error) {
Expand Down Expand Up @@ -241,8 +242,7 @@ func importForeignPackages(file *ast.File, importSpec *ast.ImportSpec, fset *tok
}
pkg, err := conf.Check(importSpec.Path.Value, fset, files, nil)
if err != nil {
// ignoring corrupted packages instead of failing
fmt.Printf("could not get imports for: %v (%v) - %v", file.Name.Name, importSpec.Path.Value, err)
result[path.Base(strings.Trim(importSpec.Path.Value, `"`))] = importSpec
return
}
for _, pkg := range pkg.Imports() {
Expand Down

0 comments on commit 84a26bf

Please sign in to comment.