Skip to content

Commit

Permalink
fix: ForEach maybe need closure
Browse files Browse the repository at this point in the history
  • Loading branch information
whatwewant committed Jan 8, 2024
1 parent 6449596 commit 9ffe408
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion container.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func (c *container) ForEach(fn func(id string, service any)) {
defer c.RUnlock()

for id, service := range c.registry {
fn(id, service)
func(id string, service any) {
fn(id, service)
}(id, service)
}
}

0 comments on commit 9ffe408

Please sign in to comment.