The interface documentation shows how to define an interface and use it in arguments. But it doesn't show how to use the interface in the return value. I tried, but it doesn't seem to be possible.
It would be very useful to make this possible.
Example:
type Check interface {
Pass() bool
Details() string
}
type MyCheck struct {}
func (c *MyCheck) Pass() bool {
return true
}
func (c *MyCheck) Details() string {
return "my check always passes!"
}
type MyModule struct{}
func (m *MyModule) Check() Check {
return new(MyCheck)
}
The interface documentation shows how to define an interface and use it in arguments. But it doesn't show how to use the interface in the return value. I tried, but it doesn't seem to be possible.
It would be very useful to make this possible.
Example: