检测类型是否实现接口
package main
type color struct {
r, g, b, a int
}
func (c *color) GetRGBA() (int, int, int, int) {
return c.r, c.g, c.b, c.a
}
type Color interface {
GetRGBA() (int, int, int, int)
}
var _ Color = (*color)(nil)
https://segmentfault.com/a/1190000022255009#item-3-4