Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsImplements ¶
func IsImplements(obj interface{}, ifPtr interface{}) bool
IsImplements IsImplements(&struct{}, (*struct)(nil)) check implements interface *
type Father interface {
Father()
}
type Son1 struct {
i int
}
func (_self *Son1) Father() {
fmt.Println()
}
type Son2 struct {
i int
}
func (_self *Son2) Father() {
fmt.Println()
}
type FakeSon struct { }
func TestIsImplementInterface(t *testing.T) {
println(IsImplements(Son1{}, (*Father)(nil))) >>false
println(IsImplements(&Son2{}, (*Father)(nil))) >>true
println(IsImplements(&FakeSon{}, (*Father)(nil))) >> false
}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.