jjzjj

servicesA

全部标签

json - for 循环上的 goroutine channel

我的main函数从文件中读取json,将其解码为结构,将其转换为另一种结构类型,然后通过stdout输出格式化的JSON。我正在尝试实现goroutines和channel来为我的for循环添加并发。funcmain(){muvMap:=map[string]string{"male":"M","female":"F"}fileA,err:=os.Open("serviceAfileultimate.json")iferr!=nil{panic(err)}deferfileA.Close()data:=make([]byte,10000)count,err:=fileA.Read(da