摘要: 出现原因 GO type DB struct { mutex sync.Mutex store map[string][3]float64 } func (db DB) nearest(target [3]float64) string { var filename string db.mutex. 阅读全文
posted @ 2018-03-24 12:32 cucy_to 阅读(386) 评论(0) 推荐(0)
摘要: 死锁 go package main import "fmt" func callerA(c chan string) { c 阅读全文
posted @ 2018-03-24 11:12 cucy_to 阅读(169) 评论(0) 推荐(0)
摘要: ```go package main import ( "bufio" "fmt" "io" "net" ) func main() { l, err := net.Listen("tcp", ":8080") if err != nil { panic(err) } for { fmt.Println("Waiting for client...") conn... 阅读全文
posted @ 2018-03-24 00:06 cucy_to 阅读(110) 评论(0) 推荐(0)
摘要: ```go package main import ( "log" "net" "net/rpc" "net/rpc/jsonrpc" ) type Args struct { A, B int } type Result int type RpcServer struct{} func (t RpcServer) Add(args *Args, result *Result)... 阅读全文
posted @ 2018-03-24 00:04 cucy_to 阅读(92) 评论(0) 推荐(0)
摘要: ```go package main import ( "crypto/tls" "fmt" "net/smtp" ) func main() { var email string fmt.Println("Enter username for smtp: ") fmt.Scanln(&email) var pass string fmt.Println("Enter p... 阅读全文
posted @ 2018-03-24 00:03 cucy_to 阅读(140) 评论(0) 推荐(0)
摘要: ```go package main import ( "encoding/json" "fmt" "io" "io/ioutil" "net/http" "strconv" "strings" ) const addr = "localhost:7070" type City struct { I 阅读全文
posted @ 2018-03-24 00:01 cucy_to 阅读(99) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "net/http" ) const addr = "localhost:7070" type RedirecServer struct { redirectCount int } func (s *RedirecServer) ServeHTTP(rw http.ResponseWriter, req *htt... 阅读全文
posted @ 2018-03-24 00:00 cucy_to 阅读(210) 评论(0) 推荐(0)