Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outpkg not respected when inpackage: True is set #845

Closed
LandonTClipp opened this issue Nov 19, 2024 · 0 comments · Fixed by #846
Closed

outpkg not respected when inpackage: True is set #845

LandonTClipp opened this issue Nov 19, 2024 · 0 comments · Fixed by #846

Comments

@LandonTClipp
Copy link
Collaborator

This happens in generator.go:

// GeneratePrologue generates the prologue of the mock.
func (g *Generator) GeneratePrologue(ctx context.Context, pkg string) {
	g.populateImports(ctx)
	if g.config.InPackage {
		g.printf("package %s\n\n", g.iface.Pkg.Name())
	} else {
		g.printf("package %v\n\n", pkg)
	}

	g.generateImports(ctx)
	g.printf("\n")
}

The outpkg parameter is completely ignored in this case, which prevents us from giving the mocks a package name like original_pkg_test. I will create a parameter that allows us to override this behavior and always respect outpkg. Sadly, we have to retain backwards compatability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant