Just change
func (a *A) FB() *B {
return a.b
}
into
func (a *A) FB() IB {
return a.b
}
Surely IB
can be defined in another package. So if both interfaces are defined in package foo
and the implementations are in package bar
, then the declaration is
type IA interface {
FB() IB
}
while the implementation is
func (a *A) FB() foo.IB {
return a.b
}