Writing good unit tests is made much easier by dependency injection. This lets you separate your code’s behavior from that of your dependencies: type MyType struct { dep1 DependencyOne dep2 DependencyTwo } func GoodConstructor(dep1 DependencyOne, dep2 DependencyTwo) *MyType { return &MyType{ dep1: dep1, dep2: dep2, } } func BadConstructor() *MyType { return &MyType{ dep1: NewDepOne(), dep2: NewDepTwo(), } } The example’s a little bit contrived, because you could just directly write dep1 to the struct field, but for types with complex initialization, the testability of a type created with GoodConstructor is much higher.