基本信息
源码名称:GO-IN-ACTION
源码大小:5.79M
文件格式:.pdf
开发语言:Go
更新时间:2022-11-05
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
GO-IN-ACTION

contents
foreword xi
preface xiii
acknowledgments xiv
about this book xvi
about the cover illustration xix
1
Introducing Go 1
1.1 Solving modern programming challenges with Go 2
Development speed 3

Concurrency 3

Go’s type system 5
Memory management 7
1.2 Hello, Go 7
Introducing the Go Playground 8
1.3 Summary 8
2
Go quick-start 9
2.1 Program architecture 10
2.2 Main package 11
2.3 Search package 13
search.go 14

feed.go 22

match.go/default.go 26
2.4 RSS matcher 32
2.5 Summary 38
Licensed to Mark Watson <nordickan@gmail.com>
CONTENTS viii
3
Packaging and tooling 39
3.1 Packages 40
Package-naming conventions 40

Package main 40
3.2 Imports 42
Remote imports 42

Named imports 43
3.3 init 44
3.4 Using Go tools 45
3.5 Going farther with Go developer tools 47
go vet 47

Go format 48

Go documentation 48
3.6 Collaborating with other Go developers 51
Creating repositories for sharing 51
3.7 Dependency management 52
Vendoring dependencies 52

Introducing gb 54
3.8 Summary 56
4
Arrays, slices, and maps 57
4.1 Array internals and fundamentals 57
Internals 58

Declaring and initializing 58

Working with
arrays 60

Multidimensional arrays 62

Passing arrays
between functions 64
4.2 Slice internals and fundamentals 65
Internals 65

Creating and initializing 65

Working with
slices 68

Multidimensional slices 79

Passing slices between
functions 80
4.3 Map internals and fundamentals 81
Internals 81

Creating and initializing 83

Working with
maps 84

Passing maps between functions 86
4.4 Summary 87
5
Go’s type system 88
5.1 User-defined types 89
5.2 Methods 92
5.3 The nature of types 96
Built-in types 96

Reference types 97

Struct types 98
Licensed to Mark Watson <nordickan@gmail.com>
CONTENTS ix
5.4 Interfaces 101
Standard library 102

Implementation 104

Method
sets 105

Polymorphism 109
5.5 Type embedding 111
5.6 Exporting and unexporting identifiers 119
5.7 Summary 127
6
Concurrency 128
6.1 Concurrency versus parallelism 129
6.2 Goroutines 132
6.3 Race conditions 139
6.4 Locking shared resources 142
Atomic functions 142

Mutexes 145
6.5 Channels 147
Unbuffered channels 148

Buffered channels 153
6.6 Summary 157
7
Concurrency patterns 158
7.1 Runner 158
7.2 Pooling 167
7.3 Work 177
7.4 Summary 183
8
Standard library 184
8.1 Documentation and source code 185
8.2 Logging 187
Log package 187

Customized loggers 191
Conclusion 195
8.3 Encoding/Decoding 196
Decoding JSON 196

Encoding JSON 201
Conclusion 202
8.4 Input and output 203
Writer and Reader interfaces 203

Working together 205
Simple curl 208

Conclusion 210
8.5 Summary 210
Licensed to Mark Watson <nordickan@gmail.com>
CONTENTS x
9
Testing and benchmarking 211
9.1 Unit testing 212
Basic unit test 212

Table tests 216

Mocking calls 219
Testing endpoints 223
9.2 Examples 228
9.3 Benchmarking 232
9.4 Summary 236
index 237