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

Commit e00cb15

Browse files
linzhpcodyoss
authored andcommitted
Always remove self_package import (#343)
1 parent 0800f9a commit e00cb15

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

mockgen/internal/tests/self_package/mock.go

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:generate mockgen -package core -self_package github.com/golang/mock/mockgen/internal/tests/self_package -destination mock.go github.com/golang/mock/mockgen/internal/tests/self_package Methods
2+
package core
3+
4+
type Info struct {
5+
name string
6+
}
7+
8+
type Methods interface {
9+
getInfo() Info
10+
}

mockgen/mockgen.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ func sanitize(s string) string {
235235
}
236236

237237
func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPackagePath string) error {
238-
if outputPkgName != pkg.Name {
238+
if outputPkgName != pkg.Name && *selfPackage == "" {
239+
// reset outputPackagePath if it's not passed in through -self_package
239240
outputPackagePath = ""
240241
}
241242

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy