Go Concurrency
摘要:【Go Concurrency】1、Agoroutineis a lightweight thread managed by the Go runtime. 2、Channels are a typed conduit through which you can send and receive ...
阅读全文
Go Methods and Interfaces
摘要:【Go Methods and Interfaces】1、Go does not have classes. However, you can define methods on struct types. Themethod receiverappears in its own argument...
阅读全文
Go structs、slices、maps
摘要:【Go structs、slices、maps】1、定义时*在变量名后面,使用时*在变量名前面。 2、定义struct,type在前,struct关键字在后。 3、指针可以指定struct。 4、A struct literal denotes a newly allocated stru...
阅读全文
Defer 声明的设计理念
摘要:【Defer 声明的设计理念】 Adefer statementpushes a function call onto a list. The list of saved calls is executed after the surrounding function returns. Defer...
阅读全文
Go Flow Control
摘要:【Go Flow Control】1、for没有(),必须有{}。 2、for的前后表达式可以为空。 3、没有while,for即是while。 4、无穷循环。 5、if没有(),必须有{}。 6、if临时变量。 Likefor, theifstatement can start wit...
阅读全文
Go Packages、Variables、functions
摘要:【Go Packages、Variables、functions】1、定义包名。 2、引入Package。 3、定义导出的变量。首字母必须大写。 4、函数。Notice that the type comesafterthe variable name. 5、参数缩写。 6、函数可以返回任...
阅读全文
Why Go's Declaration Syntax is better than C++?
摘要:【Why Go's Declaration Syntax is better than C++?】 Newcomers to Go wonder why the declaration syntax is different from the tradition established in th...
阅读全文