多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
> # 并发读有写报错: fatal error: concurrent map read and map write ``` package main import ( "time" ) func main() { m := make(map[int]string) for i := 0; i < 100; i++ { go func() { for j := 0; j < 1000; j++ { go func() { _ = m[0] }() } }() } // 启动 100 个 goroutine 执行写操作 for i := 0; i < 1000; i++ { m[1] = "A" } time.Sleep(time.Second * 10) } ```