原创 Golang goroutine and channel

/** golang goroutine and channel */ package main import ( "fmt" _ "io" _ "os" _ "reflect" "runtime" _ "runtime

原创 golang rpc tcp

//手動一遍 package main import ( "net/rpc" "log" "net" "time" ) type Args struct { A, B int } type Arith int func

原创 golang defer

/** golang defer */ package main import ( "fmt" ) var p = fmt.Println var pf = fmt.Printf func main() { defer fm

原创 Golang for if switch

/** golang if for switch */ package main import ( "fmt" "math" "time" ) var p = fmt.Println var pf = fmt.Print

原创 golang 上傳文件

golang http 上傳文件記錄 // 測試客戶端上傳文件 package main import ( "bytes" "fmt" "io" "io/ioutil" "mime/multip

原创 golang Map

golang Map /** golang map map的key必須是除了func類型,array,slice,map類型之外的類型 */ package main import ( "fmt" "reflec