Skip to content

Commit 5f7a072

Browse files
eval-execsenghoo
authored andcommitted
fix typo: buttion -> button
1 parent ef73f66 commit 5f7a072

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

11_command/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
示例中把主板单中的启动(start)方法和重启(reboot)方法封装为命令对象,再传递到主机(box)对象中。于两个按钮进行绑定:
66

7-
* 第一个机箱(box1)设置按钮1(buttion1) 为开机按钮2(buttion2)为重启。
8-
* 第二个机箱(box1)设置按钮2(buttion2) 为开机按钮1(buttion1)为重启。
7+
* 第一个机箱(box1)设置按钮1(button1) 为开机按钮2(button2)为重启。
8+
* 第二个机箱(box1)设置按钮2(button2) 为开机按钮1(button1)为重启。
99

1010
从而得到配置灵活性。
1111

11_command/command.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ func (*MotherBoard) Reboot() {
4545
}
4646

4747
type Box struct {
48-
buttion1 Command
49-
buttion2 Command
48+
button1 Command
49+
button2 Command
5050
}
5151

52-
func NewBox(buttion1, buttion2 Command) *Box {
52+
func NewBox(button1, button2 Command) *Box {
5353
return &Box{
54-
buttion1: buttion1,
55-
buttion2: buttion2,
54+
button1: button1,
55+
button2: button2,
5656
}
5757
}
5858

59-
func (b *Box) PressButtion1() {
60-
b.buttion1.Execute()
59+
func (b *Box) PressButton1() {
60+
b.button1.Execute()
6161
}
6262

63-
func (b *Box) PressButtion2() {
64-
b.buttion2.Execute()
63+
func (b *Box) PressButton2() {
64+
b.button2.Execute()
6565
}

11_command/command_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ func ExampleCommand() {
66
rebootCommand := NewRebootCommand(mb)
77

88
box1 := NewBox(startCommand, rebootCommand)
9-
box1.PressButtion1()
10-
box1.PressButtion2()
9+
box1.PressButton1()
10+
box1.PressButton2()
1111

1212
box2 := NewBox(rebootCommand, startCommand)
13-
box2.PressButtion1()
14-
box2.PressButtion2()
13+
box2.PressButton1()
14+
box2.PressButton2()
1515
// Output:
1616
// system starting
1717
// system rebooting

0 commit comments

Comments
 (0)