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 andcommittedJan 14, 2020
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

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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

+2-1
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)
This repository has been archived.