```少就是多，简单就是真理

var i int = 9;
i := 9
i, j, k := 1, 2, 3
i, j, k := 1, 1.0, “hello”

var (
a int
b,c string
d, e, f = 1, 2.0, "hello"
)

if i > 9 {
println(“Greater then 9”)
}

result := SomeMethod()
if result > 0 {
//
}

if result := SomeMethod(); result > 0 {

}

switch

switch tag {
default:
method3()
case 0, 1, 2:
method1()
case 3,4 , 5:
method2()
}

switch x := f(); {
case x < 0: return -x
default: return x
}

switch {
case x < y: f1()
case x < z: f2()
case x == 3: f3()
}

for i := 0; i < 10; i++ {

}

for a < b {

}

for {

}

count := len(someArray)
for i := 0; i < count; i++ {
println(someArray[i])
}

range 关键字

for i, value := range someArray {

}

m := map[string]int{"mon":0, "tue":1, "wed":2, "thu":3, "fri":4, "sat":5, "sun":6}
for i, s := range  m{

}

func returnTwoInt() (int, int) {

}

a, b := returnTwoInt()

func ReturnPointer() *Object1 {
obj := new Object1()
obj.A = “hello”
return obj
}

defer
func DoSomething() {
if f, err := os.Open("xxx"); err == nil {
defer f.Close()
// ...?
}
}

func IsReady(what string, seconds int64) {
time.Sleep(time.Duration(seconds)*time.Second);
}

fmt.Println("I'm waiting....");

I'm waiting.... (right away)
coffee is ready (2 min later)
tea is ready (6 min later)

ch := make(chan int) //创建一个传递整型的通道

func pump(ch chan int) {
for i := 0; ; i++ { ch <- i } //往通道里写值入
}

func suck(ch chan int) {
for { fmt.Println(<-ch) } // 取出
}

go pump(ch) // 异步执行pump

go suck(ch) // 异步执行suck

pump 泵
suck 吸
```

go程序设计语言01_05入门之获取URL

go程序设计语言01_06入门之并发获取多个URL

GO箴言 goproverbs

GO多线程异步处理实例

go channel 实例

godoc安装