摘要:
Channels are the pipes that connect concurrent goroutines. You can send values into channels from one goroutine andreceive those values into another g... 阅读全文
摘要:
In Go it's idiomatic to communicate errors via an explicit, separate return value. this constrasts errors via an explicit, separate return value. This... 阅读全文
摘要:
Go supports methods defined on struct typespackage mainimport ( "fmt")type rect struct { width, height int}func (r *rect) area() int { return... 阅读全文
摘要:
Go's structs are typed collections of fields. They're useful for grouping data together to form recordspackage mainimport ( "fmt")type person struc... 阅读全文
摘要:
Go support pointers, allowing you to pass references to values and records within your programpackage mainimport ( "fmt")func zeroval(ival int) { ... 阅读全文
摘要:
Go supports anonymous functions, which can form closures. Anonymous functions are useful when you want to define a function inline without having to n... 阅读全文
摘要:
Variadic functions can be called with any number of trailing arguments. For example, fmt.Println is a common variadic functionpackage mainimport ( ... 阅读全文