本帖最后由 scourglass22 于 2019-11-5 23:04 编辑

1.png (244.23 KB, 下载次数: 19)

2019-11-5 22:20 上传


Cont ents
Pr eface  xi
The Origins of Go xii
The Go Pro jec t xiii
Organizat ion of the Book xv
Wh ere to Find More Infor mat ion xvi
Ac knowledgments  xvii
1. Tutorial 1
1.1. Hel lo, Wor ld 1
1.2. Command-L ine Arguments  4
1.3. Finding Dup lic ate Lines  8
1.4. Animated GIFs  13
1.5. Fetching a URL  15
1.6. Fetching URLs Con cur rently 17
1.7. A We b Server  19
1.8. Loose End s 23
2. Pro gram Str ucture 27
2.1. Names  27
2.2. Declarat ions  28
2.3. Var iables  30
2.4. Assig nments  36
2.5. Typ e Decl arat ions  39
2.6. Packages and Files  41
2.7. Scope  45
3. Basic Data Typ es 51
3.1. Int egers  51
3.2. Float ing-Point Numbers  56
3.3. Complex Numbers  61
3.4. Boole ans 63
3.5. Str ings 64
3.6. Con stants 75
4. Com posite Typ es 81
4.1. Arrays  81
4.2. Slices  84
4.3. Maps  93
4.4. Str ucts 99
4.5. JSON 107
4.6. Text and HTML Templ ates 113
5. Func tions  119
5.1. Function Declarat ions  119
5.2. Rec ursion 121
5.3. Multiple Retur n Values  124
5.4. Erro rs 127
5.5. Function Values  132
5.6. Anony mou s Func tions  135
5.7. Var iadic Functions  142
5.8. Defer red Function Cal ls 143
5.9. Panic  148
5.10. Recov er 151
6. Metho ds 155
6.1. Met hod Declarat ions  155
6.2. Met hods wit h a Point er Receiver 158
6.3. Composing Typ es by Str uct Emb edding 161
6.4. Met hod Values and Expressions  164
6.5. Example: Bit Vec tor Typ e 165
6.6. Encapsulat ion 168
7. Interfaces 171
7.1. Int erfaces as Contrac ts 171
7.2. Int erface Typ es 174
7.3. Int erface Satisfac tion 175
7.4. Parsing Flags wit h flag.Value 179
7.5. Int erface Values  181
7.6. Sor ting wit h sort.Interface 186
7.7. The http.Handler Interface  191
7.8. The error Interface  196
7.9. Example: Expression Evaluator 197
7.10. Typ e As ser tions  205
7.11. Discriminat ing Error s with Typ e As ser tions  206
7.12. Quer ying Beh avior s with Int erface Typ e As ser tions  208
7.13. Typ e Sw itch es 210
7.14. Example: Token-B ased XML Decoding 213
7.15. A Fe w Wo rds of Adv ice  216
8. Gor o utines and Channels  217
8.1. Goroutines 217
8.2. Example: Con cur rent Clo ck Ser ver  219
8.3. Example: Con cur rent Ech o Server  222
8.4. Channel s 225
8.5. Looping in Paral lel 234
8.6. Example: Con cur rent Web Craw ler 239
8.7. Multiplexing wit h select 244
8.8. Example: Con cur rent Direc tor y Traversal 247
8.9. Cancellat ion 251
8.10. Example: Chat Ser ver  253
9. Concurrency with Shared Vari ables 257
9.1. Race Con dit ion s 257
9.2. Mut ual Exc lusion: sync.Mutex 262
9.3. Read/Write Mut exes: sync.RWMutex 266
9.4. Memor y Sy nchro nizat ion 267
9.5. Lazy Initializat ion: sync.Once 268
9.6. The Race Detec tor  271
9.7. Example: Con cur rent Non-Blo cking Cache  272
9.8. Goroutines and Threads  280
10. Pack ages and the Go Tool 283
10.1. Int roduc tion 283
10.2. Imp ort Pat hs 284
10.3. The Package Declarat ion 285
10.4. Imp ort Declarat ions  285
10.5. Blank Imp orts 286
10.6. Packages and Naming 289
10.7. The Go Tool 290
11. Testing  301
11.1. The go test To ol 302
11.2. Test Func tions  302
11.3. Cov erage 318
11.4. Benchmark Func tions  321
11.5. Profiling 323
11.6. Example Func tions  326
12. Reflecti on 329
12.1. Why Reflec tion? 329
12.2. reflect.Type and reflect.Value 330
12.3. Display , a Rec ursive Value Print er 333
12.4. Example: Enco ding S-E xpressions  338
12.5. Setting Var iables wit h reflect.Value 341
12.6. Example: Decoding S-E xpressions  344
12.7. Accessing Str uct Field Tags  348
12.8. Displaying the Met hods of a Typ e 351
12.9. A Wo rd of Caution  352
13. Low-L evel Pro gramming 353
13.1. unsafe.Sizeof , Alignof , and Offsetof 354
13.2. unsafe.Pointer 356
13.3. Example: Deep Equivalence  358
13.4. Cal ling C Code wit h cgo 361
13.5. Another Word of Caution  366
Index 367

下载地址:

游客,如果您要查看本帖隐藏内容请回复