I'm testing a function which called another function in Go. And here's what I have
package b
type b struct {...}
func (b *b) functionB(){...}
package a
import "b"
type a struct {...}
func (a *a) functionA() {
b := b{...}
b.functionB()
...
}
I want to modify the function declaration in b
like this:
package b
type b struct {...}
var functionB = b.FuncInB
func (b *b) FuncInB(){...}
so that I can mock the return of functionB
in a. However, I got error message in a that says b.functionB
is undefined because it should be the function of b object. How can I make this work?