Skip to content

Commit 6d9d76f

Browse files
committed
Fmt some code examples
1 parent b307314 commit 6d9d76f

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

Diff for: zh/02.3.md

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Go里面最强大的一个控制逻辑就是`for`,它即可以用来循环读
6767
```Go
6868

6969
package main
70+
7071
import "fmt"
7172

7273
func main(){
@@ -215,6 +216,7 @@ Go里面最强大的一个控制逻辑就是`for`,它即可以用来循环读
215216
```Go
216217

217218
package main
219+
218220
import "fmt"
219221

220222
// 返回a、b中最大值.
@@ -247,6 +249,7 @@ Go语言比C更先进的特性,其中一点就是函数能够返回多个值
247249
```Go
248250

249251
package main
252+
250253
import "fmt"
251254

252255
//返回 A+B 和 A*B
@@ -293,6 +296,7 @@ Go函数支持变参。接受变参的函数是有着不定数量的参数的。
293296
```Go
294297

295298
package main
299+
296300
import "fmt"
297301

298302
//简单的一个函数,实现了参数+1的操作
@@ -322,6 +326,7 @@ Go函数支持变参。接受变参的函数是有着不定数量的参数的。
322326
```Go
323327

324328
package main
329+
325330
import "fmt"
326331

327332
//简单的一个函数,实现了参数+1的操作
@@ -400,6 +405,7 @@ Go语言中有种不错的设计,即延迟(defer)语句,你可以在函
400405
```Go
401406

402407
package main
408+
403409
import "fmt"
404410

405411
type testInt func(int) bool // 声明了一个函数类型

Diff for: zh/02.4.md

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Go语言中,也和C或者其他语言一样,我们可以声明新的类型
4444
```Go
4545

4646
package main
47+
4748
import "fmt"
4849

4950
// 声明一个新的类型
@@ -96,6 +97,7 @@ Go语言中,也和C或者其他语言一样,我们可以声明新的类型
9697
```Go
9798

9899
package main
100+
99101
import "fmt"
100102

101103
type Human struct {
@@ -148,6 +150,7 @@ Go语言中,也和C或者其他语言一样,我们可以声明新的类型
148150
```Go
149151

150152
package main
153+
151154
import "fmt"
152155

153156
type Skills []string
@@ -194,6 +197,7 @@ Go里面很简单的解决了这个问题,最外层的优先访问,也就是
194197
```Go
195198

196199
package main
200+
197201
import "fmt"
198202

199203
type Human struct {

Diff for: zh/02.5.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
```Go
77

88
package main
9+
910
import "fmt"
1011

1112
type Rectangle struct {
@@ -53,6 +54,7 @@ method的语法如下:
5354
```Go
5455

5556
package main
57+
5658
import (
5759
"fmt"
5860
"math"
@@ -134,6 +136,7 @@ method的语法如下:
134136
```Go
135137

136138
package main
139+
137140
import "fmt"
138141

139142
const(
@@ -250,6 +253,7 @@ method的语法如下:
250253
```Go
251254

252255
package main
256+
253257
import "fmt"
254258

255259
type Human struct {
@@ -286,6 +290,7 @@ method的语法如下:
286290
```Go
287291

288292
package main
293+
289294
import "fmt"
290295

291296
type Human struct {

Diff for: zh/02.6.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ interface类型定义了一组方法,如果某个对象实现了某个接口
9797
```Go
9898

9999
package main
100+
100101
import "fmt"
101102

102103
type Human struct {

0 commit comments

Comments
 (0)