moq icon indicating copy to clipboard operation
moq copied to clipboard

Don't add Mock suffix when a destination package contains mock

Open cristaloleg opened this issue 4 years ago • 1 comments

Hi, thank you for the lib, it's really awesome.

I've a case like that:

//go:generate moq -pkg mock -out ../mock/answer_store_mock.go . AnswerStore:AnswerStore
type AnswerStore interface {
	// etc
}

as you can see I'm typing AnswerStore 2 times to get rid of Mock suffix (it will be AnswerStoreMock as you can guess). But this doesn't make sense 'cause destination package will be mock, for me mock.AnswerStoreMock contains too much mock in the name :)

Is it possible to add a flag with defines exact final name (-name?) or there will be a feature to not append Mock at the end when pkg is mock (or contains mock). Latest probably will break backward compatibility :(

Thanks.

cristaloleg avatar Jun 09 '21 15:06 cristaloleg

While I agree that having to repeat the name ideally should not have been necessary, it does not seem feasible to solve this without breaking backwards compatibility. And in this case, the cost of breaking existing usages does not seem worth the cosmetic benefit.

sudo-suhas avatar Jun 25 '21 07:06 sudo-suhas

🤷

cristaloleg avatar Feb 05 '24 21:02 cristaloleg