When it comes to DI, sadly there is no silver bullet. Despite the utility of constructor injection, it cannot be used in all cases. This section covers the disadvantages and limitations of constructor injection.
Can cause lots of changes—When applying constructor injection to existing code, it can result in a lot of changes. This is particularly true if the code was initially written as functions.
Consider the following code:
// Dealer will shuffle a deck of cards and deal them to the players
func DealCards() (player1 []Card, player2 []Card) {
// create a new deck of cards
cards := newDeck()
// shuffle the cards
shuffler := &myShuffler{}
shuffler.Shuffle(cards)
// deal
player1 = append(player1, cards[0])
player2 = append(player2, cards[1])
player1 = append(player1, cards[2])
player2 = append(player2, cards[3...