goroutine 便宜但會 leak,channel 自帶同步語意,讓一個 goroutine 獨佔狀態就不用鎖,但純計數與小塊狀態用 mutex 或 atomic 更簡單,別迷信 channel。
← 標籤