FULL DISCLOSURE: This is probably really dumb, but I'm new to Go and haven't used statically-typed languages in years.
I have a function that looks like this:
func Foo(bar *bar.BarStruct) {
// do stuff with bar
}
In this example, bar is a third-party package and *bar.BarStruct is a pointer to a struct.
I would like to write a test for the Foo function while stubbing out bar.BarStruct struct. How would I stub out *bar.BarStruct?
In JavaScript for example, I would just do something like this
test('does a Foo', () => {
const mockBarStruct = {
someProp: 123
}
Foo(mockBarStruct)
// rest of test
})
What's the equivalent way to stub a struct in Go?