多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ package command import ( "testing" ) func TestCommand(t *testing.T) { invoker := NewInvoker() concomA := NewConcreteCommandA() receA := NewReceiverA() concomA.SetReceiver(*receA) invoker.AddCommand(concomA) concomB := NewConcreteCommandB() receB := NewReceiverB() concomB.SetReceiver(*receB) invoker.AddCommand(concomB) invoker.ExecuteCommand() } ~~~