Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #167 from golang/iss166
Browse files Browse the repository at this point in the history
Fix #166
  • Loading branch information
balshetzer authored Apr 4, 2018
2 parents 69521b3 + 42764bf commit 485faf3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mockgen/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,13 @@ func importsOfFile(file *ast.File) map[string]string {
pkg, err := build.Import(importPath, "", 0)
if err != nil {
// Fallback to import path suffix. Note that this is uncertain.
log.Printf("failed to import package by path %s: %s - fallback to import path suffix", importPath, err.Error())
_, last := path.Split(importPath)
// If the last path component has dots, the first dot-delimited
// field is used as the name.
pkgName = strings.SplitN(last, ".", 2)[0]
} else {
pkgName = pkg.Name
}
pkgName = pkg.Name
}

if _, ok := m[pkgName]; ok {
Expand Down
1 change: 1 addition & 0 deletions mockgen/tests/vendor_dep/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package vendor_dep

//go:generate mockgen -package vendor_dep -destination mock.go github.com/golang/mock/mockgen/tests/vendor_dep VendorsDep
//go:generate mockgen -destination source_mock_package/mock.go -source=vendor_dep.go
46 changes: 46 additions & 0 deletions mockgen/tests/vendor_dep/source_mock_package/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 485faf3

Please sign in to comment.