import "sync"
var (
myMap = make(map[int]int, 10)
lock sync.Mutex
//声明一个全局的互斥锁
//sync 包 同步
// Mutex:是互斥
)
func test(n int){
res := 1
for i:=1;i<=n;i++{
res *=1
}
lock.Lock()
myMap[n] = res //concurrent map write
lock.Unlock()
}
func main(){
for i :=1;i<200;i++{
go test(i)
}
}