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

Support non-basic type constraints #200

Open
samherrmann opened this issue Aug 7, 2023 · 1 comment
Open

Support non-basic type constraints #200

samherrmann opened this issue Aug 7, 2023 · 1 comment

Comments

@samherrmann
Copy link
Contributor

samherrmann commented Aug 7, 2023

This issue is to track the limitation that was mentioned in the description of #175.

Consider the following interface:

type Sorter[T comparable] interface {
	Sort(slice []T) []T
}

When generating a mock using moq v0.3.2, the following implementation check is created:

var _ Sorter[comparable] = &SorterMock[comparable]{}

This code is not valid due to the following reason:

cannot use type comparable outside a type constraint: interface is (or embeds) comparable

@samherrmann
Copy link
Contributor Author

My current workaround is to use the -skip-ensure flag. This workaround prevents me from having to manually modify the generated mock file, which is crucial because this allows go generate ./... to be re-run on the project without overwriting manual changes.

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

No branches or pull requests

1 participant