ZhangZhihui's Blog  

2024年6月13日

摘要: server.go: package main import ( "fmt" "log" "net/http" "os" "time" "github.com/gorilla/websocket" ) var port = ":1234" var upgrader = websocket.Upgra 阅读全文
posted @ 2024-06-13 21:29 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: package main import ( "context" "fmt" "os" "strconv" "time" "golang.org/x/sync/semaphore" ) func worker(n int) int { square := n * n time.Sleep(time.S 阅读全文
posted @ 2024-06-13 20:26 ZhangZhihuiAAA 阅读(15) 评论(0) 推荐(0) 编辑
 
摘要: Reading from a closed channel returns the zero value of its data type. However, if you try to write to a closed channel, your program is going to cras 阅读全文
posted @ 2024-06-13 19:36 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑