我算是明白了,别说 go wire 了,勾八连 GO 这个语言能不能靠得住都挺难说的。既然如此,还是大胆一点吧。俗话说得好,所有让人难绷的细节都是为了宏观上的达成意图的方便。那就来吧。
14 lines
172 B
Go
14 lines
172 B
Go
package pasture
|
|
|
|
type Sheep struct {
|
|
lines string
|
|
}
|
|
|
|
func (s *Sheep) Sound() string {
|
|
return s.lines
|
|
}
|
|
|
|
func NewSheep(line string) *Sheep {
|
|
return &Sheep{lines: line}
|
|
}
|