Go worker pool with repetitive queue structure
问题 I'm trying make worker pool with looped queue. Is my code idiomatic for Go? And how can I solve concurrent access to *Item ? Pool processing 1 item at time and *Item don't shared between workers, but sometimes I need change *Item from main thread. Should I place mutex at every *Item and when I should lock/unlock it? Or maybe some other structure is possible? var items = make(map[uint8]*Item) func worker(queue, done chan uint8) { for id := range queue { item := items[id] // get from http