Is it possible to do something like a "mutual" package import in Golang?
Lets say for example I have two packages, A and B with functions AFunc and BFunc, BFunc2
package A
import "B"
func AFunc() {
//do stuff but also use
B.BFunc()
}
-
package B
import "A"
func BFunc() {
//do foo
}
func BFunc2() {
//do different stuff but also use
A.AFunc()
}
Is there a way to achieve this without using a third package as "bridge"?
Edit:
To clarify the question a bit, this is of course not possible by "simply doing" it since the compiler will throw an import cycle not allowed
error. The question is, is there a cleaner or more established way of working around this problem then building a "bridge package"?