I am writing a unit test for a package in golang. I need to create a variable of private field type which resides in a different package to pass it as a parameter to the function that I am testing.
package : go/abc/a.go
type newType int
package : go/edf/b.go
import "go/abc"
func init(abc newType){
// ommitted for brevity
}
Now I am writing unit test for b.go say
package : go/edf/b_test.go
func TestInit(){
// Now I need to create a variable of private field type newType in abc package
// for passing as parameter to the init function....
}
Is it possible to achieve this using reflect or packages package in golang