Skip to content

Commit

Permalink
Allow mock-pkg to be the "_test" package
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Aug 26, 2016
1 parent cf49914 commit 04f8f06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion automock/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Generator struct {

// NewGenerator initializes a Generator that will mock the given interface from the specified package.
func NewGenerator(pkg, iface string) (*Generator, error) {
p, err := importer.DefaultWithTestFiles().Import(pkg)
p, err := importer.Default().Import(pkg)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/goautomock/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func main() {
if *mockName != "" {
gen.SetName(*mockName)
}
inPkg := *pkg == "." && path.Dir(*out) == "."
inPkg := *pkg == "." && (path.Dir(*out) == "." && !strings.HasSuffix(*mockPkg, "_test"))
gen.SetInternal(inPkg)
if *mockPkg == "" && !inPkg {
p, err := importer.Default().Import(".")
Expand Down

0 comments on commit 04f8f06

Please sign in to comment.