go race 检测锁竞争

66 阅读1分钟

当使用多协程时,可能会有多个协程同时操作一个对象,可以通过go run -race main.go检测可能存的竞争