mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-20 16:45:56 +08:00
Merge pull request #95 from kennethy/patch-1
Add comments to indicate it's a bad/good example
This commit is contained in:
commit
1074108bce
1 changed files with 2 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ func main() {
|
|||
}
|
||||
|
||||
type Counter struct {
|
||||
mu sync.Mutex
|
||||
mu sync.Mutex // bad
|
||||
counters map[string]int
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ func (c *Counter) Increment2(name string) {
|
|||
}
|
||||
|
||||
type Counter2 struct {
|
||||
mu *sync.Mutex
|
||||
mu *sync.Mutex // good
|
||||
counters map[string]int
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue