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

Best effort guesses for output package path #547

Merged
merged 2 commits into from Apr 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions mockgen/mockgen.go
Expand Up @@ -136,12 +136,15 @@ func main() {
outputPackagePath := *selfPackage
if outputPackagePath == "" && *destination != "" {
dstPath, err := filepath.Abs(filepath.Dir(*destination))
if err != nil {
log.Fatalf("Unable to determine destination file path: %v", err)
}
outputPackagePath, err = parsePackageImport(dstPath)
if err != nil {
log.Fatalf("Unable to determine destination file path: %v", err)
if err == nil {
pkgPath, err := parsePackageImport(dstPath)
if err == nil {
outputPackagePath = pkgPath
} else {
log.Println("Unable to infer -self_package from destination file path:", err)
}
} else {
log.Println("Unable to determine destination file path:", err)
}
}

Expand Down