Is there a better dependency injection pattern in golang?

后端 未结 6 1959
野趣味
野趣味 2021-02-07 09:07

Given this code:

package main

import (
    \"fmt\"
)

type datstr string

type Guy interface {
   SomeDumbGuy() string
}

func (d *datstr) SomeDumbGuy() string          


        
6条回答
  •  长发绾君心
    2021-02-07 09:29

    Uber's Dig is pretty awesome. Here's a great blog post about it: Dependency Injection in Go

提交回复
热议问题