Skip to content

Commit

Permalink
changed variable name so it's not the same as it's type:
Browse files Browse the repository at this point in the history
waitGroup *sync.WaitGroup to wg *sync.WaitGroup
  • Loading branch information
s77rt committed May 17, 2021
1 parent f77a96b commit 18cceb5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/preferences.go
Expand Up @@ -11,7 +11,7 @@ type InMemoryPreferences struct {
values map[string]interface{}
lock sync.RWMutex
changeListeners []func()
waitGroup *sync.WaitGroup
wg *sync.WaitGroup
}

// Declare conformity with Preferences interface
Expand All @@ -24,7 +24,7 @@ func (p *InMemoryPreferences) AddChangeListener(listener func()) {
defer p.lock.Unlock()

p.changeListeners = append(p.changeListeners, func() {
defer p.waitGroup.Done()
defer p.wg.Done()
listener()
})
}
Expand Down Expand Up @@ -76,11 +76,11 @@ func (p *InMemoryPreferences) fireChange() {
defer p.lock.RUnlock()

for _, l := range p.changeListeners {
p.waitGroup.Add(1)
p.wg.Add(1)
go l()
}

p.waitGroup.Wait()
p.wg.Wait()
}

// Bool looks up a boolean value for the key
Expand Down Expand Up @@ -187,7 +187,7 @@ func (p *InMemoryPreferences) RemoveValue(key string) {
// NewInMemoryPreferences creates a new preferences implementation stored in memory
func NewInMemoryPreferences() *InMemoryPreferences {
return &InMemoryPreferences{
values: make(map[string]interface{}),
waitGroup: &sync.WaitGroup{},
values: make(map[string]interface{}),
wg: &sync.WaitGroup{},
}
}

0 comments on commit 18cceb5

Please sign in to comment.