@
Jooooooooo 可能是我设计有问题
type Handler struct {
A map[string]interface{}
B map[string]interface{}
C map[string]interface{}
D map[string]interface{}
E map[string]interface{}
}
func (a *Handler) SetA(inputList []interface{}) {
for _, input := range inputList {
a.A["key"] = input
}
}
func (a *Handler) DoA() (result map[string]string, err error) {
// do something
return
}
func (a *Handler) DoB() (result map[string]string, err error) {
// do something
return
}
func (a *Handler) DoC() (result map[string]string, err error) {
// do something
return
}
func NewHandler() Handler {
return Handler{
A: map[string]interface{}{},
B: map[string]interface{}{},
C: map[string]interface{}{},
D: map[string]interface{}{},
E: map[string]interface{}{},
}
}
func main() {
instance := NewHandler()
instance.SetA([]interface{}{})
//忘记 SetB SetC
result, err := instance.DoA()
result, err = instance.DoB()
result, err = instance.DoC()
}