Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.