From 123f2d3e4e0ba87354a9300f4e51b3064aa2699b Mon Sep 17 00:00:00 2001 From: John Date: Sun, 12 May 2019 21:26:01 +0800 Subject: [PATCH] remove return value from RLockFunc/LockFunc for gset --- g/container/gset/gset.go | 6 ++---- g/container/gset/gset_int_set.go | 6 ++---- g/container/gset/gset_string_set.go | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/g/container/gset/gset.go b/g/container/gset/gset.go index 7f01bc45d..8c02bd33b 100644 --- a/g/container/gset/gset.go +++ b/g/container/gset/gset.go @@ -125,19 +125,17 @@ func (set *Set) String() string { } // LockFunc locks writing with callback function . -func (set *Set) LockFunc(f func(m map[interface{}]struct{})) *Set { +func (set *Set) LockFunc(f func(m map[interface{}]struct{})) { set.mu.Lock() defer set.mu.Unlock() f(set.m) - return set } // RLockFunc locks reading with callback function . -func (set *Set) RLockFunc(f func(m map[interface{}]struct{})) *Set { +func (set *Set) RLockFunc(f func(m map[interface{}]struct{})) { set.mu.RLock() defer set.mu.RUnlock() f(set.m) - return set } // Equal checks whether the two sets equal. diff --git a/g/container/gset/gset_int_set.go b/g/container/gset/gset_int_set.go index 6e018d5fa..338952ff8 100644 --- a/g/container/gset/gset_int_set.go +++ b/g/container/gset/gset_int_set.go @@ -119,19 +119,17 @@ func (set *IntSet) String() string { } // LockFunc locks writing with callback function . -func (set *IntSet) LockFunc(f func(m map[int]struct{})) *IntSet { +func (set *IntSet) LockFunc(f func(m map[int]struct{})) { set.mu.Lock() defer set.mu.Unlock() f(set.m) - return set } // RLockFunc locks reading with callback function . -func (set *IntSet) RLockFunc(f func(m map[int]struct{})) *IntSet { +func (set *IntSet) RLockFunc(f func(m map[int]struct{})) { set.mu.RLock() defer set.mu.RUnlock() f(set.m) - return set } // Equal checks whether the two sets equal. diff --git a/g/container/gset/gset_string_set.go b/g/container/gset/gset_string_set.go index 4664e5808..7a5d20da4 100644 --- a/g/container/gset/gset_string_set.go +++ b/g/container/gset/gset_string_set.go @@ -120,19 +120,17 @@ func (set *StringSet) String() string { } // LockFunc locks writing with callback function . -func (set *StringSet) LockFunc(f func(m map[string]struct{})) *StringSet { +func (set *StringSet) LockFunc(f func(m map[string]struct{})) { set.mu.Lock() defer set.mu.Unlock() f(set.m) - return set } // RLockFunc locks reading with callback function . -func (set *StringSet) RLockFunc(f func(m map[string]struct{})) *StringSet { +func (set *StringSet) RLockFunc(f func(m map[string]struct{})) { set.mu.RLock() defer set.mu.RUnlock() f(set.m) - return set } // Equal checks whether the two sets equal.