Merge pull request #95 from kennethy/patch-1

Add comments to indicate it's a bad/good example
This commit is contained in:
Teiva Harsanyi 2024-07-17 16:54:13 +02:00 committed by GitHub
commit 1074108bce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ func main() {
} }
type Counter struct { type Counter struct {
mu sync.Mutex mu sync.Mutex // bad
counters map[string]int counters map[string]int
} }
@ -38,7 +38,7 @@ func (c *Counter) Increment2(name string) {
} }
type Counter2 struct { type Counter2 struct {
mu *sync.Mutex mu *sync.Mutex // good
counters map[string]int counters map[string]int
} }