Is there a better dependency injection pattern in golang?

后端 未结 6 1892
野趣味
野趣味 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:34

    Google's Wire looks promising. There're some articles about it:

    • Compile-time Dependency Injection With Go Cloud's Wire

    • Go Dependency Injection with Wire

提交回复
热议问题