golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

wildcard support #21

Closed nizsheanez closed 8 years ago

nizsheanez commented 8 years ago

now we have lot's of interfaces and our comand look like:

//go:generate mockgen -package mocks -destination destpath.go package_name Interface1,Interface2,Interface3,Interface4,Interface5,Interface6,Interface7,Interface8,Interface9,Interface10,Interface11,Interface12,Interface12

Can we change it to

//go:generate mockgen -package mocks -destination destpath.go package_name "*"

?

dsymonds commented 8 years ago

Go's reflection support does not permit reflecting over a package, so there'd be no way to implement a wildcard like that.

If you have a specific package in mind, perhaps you can automate by grep+sed to extract the names of all the exported interfaces?

nizsheanez commented 8 years ago

Reflection doesn't, maybe Ast support, will check...

dsymonds commented 8 years ago

I think this is working as intended, and working as possible.