You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DO NOT submit tickets without first using the latest version of Golang, clearing your local golang package cache, and re-building mockery using the latest Golang version and the latest version of mockery. Please provide evidence this has been done in your issue. Failure to provide this evidence will likely result in your issue being closed.
Description
inpackage config option is not used when used under packages
Mockery Version
2.43.0
Golang Version
1.22.2
Installation Method
Binary Distribution
Docker
brew
go install
Other: [specify]
Steps to Reproduce
Use the package configuration method
Create a go module, e.g. github.com/emreler/foo
Define an interface in a subpackage, e.g. github.com/emreler/foo/bar
Create a .mockery.yaml config file like provided below
Hi, sorry to be terse but migrating to packages has been thoroughly documented. It describes how you need additional configuration to specify where your mocks are placed. It seems you are simply lacking the right config.
Indeed I've missed the dir parameter from my config and I get the desired behaviour when I set it to "{{.InterfaceDir}}", thanks for the reply.
The reason for the confusion was that I was expecting the mock to be placed in the same package as my interface when inpackage: true was set, regardless of the dir parameter. It feels like dir could be set to "{{.InterfaceDir}}" automatically when inpackage: true since if you place your mock in a different package then it's not in package anymore.
inpackage can probably be removed at some point once we make mockery a bit smarter. It's needed to tell mockery whether or not you've placed the mocks in the same location as the original interface, as the imports and namespaces will be different. Mockery could probably determine this automatically. I just never got around to it, thus we're stuck with needing inpackage for now.
PLEASE READ
DO NOT submit tickets without first using the latest version of Golang, clearing your local golang package cache, and re-building mockery using the latest Golang version and the latest version of mockery. Please provide evidence this has been done in your issue. Failure to provide this evidence will likely result in your issue being closed.
Description
inpackage
config option is not used when used underpackages
Mockery Version
2.43.0
Golang Version
1.22.2
Installation Method
Steps to Reproduce
package
configuration methodgithub.com/emreler/foo
github.com/emreler/foo/bar
.mockery.yaml
config file like provided belowConfig:
Expected Behavior
Mock file to be created under
github.com/emreler/foo/bar
Actual Behavior
Mock file is created under
github.com/emreler/mocks/github.com/emreler/foo/bar
The issue seems to be not there when using the old configuration method, e.g. like below:
The text was updated successfully, but these errors were encountered: