add gocritic/ruleguard checks back again, cleanup code. (#13665)

- remove some duplicated code
- reported a bug, separately fixed in #13664
- using strings.ReplaceAll() when needed
- using filepath.ToSlash() use when needed
- remove all non-Go style comments from the codebase

Co-authored-by: Aditya Manthramurthy <donatello@users.noreply.github.com>
This commit is contained in:
HarshavardhanaandAditya Manthramurthy authored and GitHub committed 2021-11-16 09:28:29 -08:00
1 parent 07c5e72cdb
commit 661b263e77
111 files changed
+409 -450

No files matched your search

+4 -4
View File
@@ -199,9 +199,9 @@ func (dm *DRWMutex) lockBlocking(ctx context.Context, lockLossCallback func(), i
// If success, copy array to object
if isReadLock {
copy(dm.readLocks, locks[:])
copy(dm.readLocks, locks)
} else {
copy(dm.writeLocks, locks[:])
copy(dm.writeLocks, locks)
}
dm.m.Unlock()
@@ -579,7 +579,7 @@ func (dm *DRWMutex) Unlock() {
}
// Copy write locks to stack array
copy(locks, dm.writeLocks[:])
copy(locks, dm.writeLocks)
}
// Tolerance is not set, defaults to half of the locker clients.
@@ -620,7 +620,7 @@ func (dm *DRWMutex) RUnlock() {
}
// Copy write locks to stack array
copy(locks, dm.readLocks[:])
copy(locks, dm.readLocks)
}
// Tolerance is not set, defaults to half of the locker clients.