mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Run modernize (#21546)
`go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...` executed. `go generate ./...` ran afterwards to keep generated.
This commit is contained in:
@@ -157,18 +157,18 @@ func doTestParallelReaders(numReaders, gomaxprocs int) {
|
||||
clocked := make(chan bool)
|
||||
cunlock := make(chan bool)
|
||||
cdone := make(chan bool)
|
||||
for i := 0; i < numReaders; i++ {
|
||||
for range numReaders {
|
||||
go parallelReader(context.Background(), m, clocked, cunlock, cdone)
|
||||
}
|
||||
// Wait for all parallel RLock()s to succeed.
|
||||
for i := 0; i < numReaders; i++ {
|
||||
for range numReaders {
|
||||
<-clocked
|
||||
}
|
||||
for i := 0; i < numReaders; i++ {
|
||||
for range numReaders {
|
||||
cunlock <- true
|
||||
}
|
||||
// Wait for the goroutines to finish.
|
||||
for i := 0; i < numReaders; i++ {
|
||||
for range numReaders {
|
||||
<-cdone
|
||||
}
|
||||
}
|
||||
@@ -184,13 +184,13 @@ func TestParallelReaders(t *testing.T) {
|
||||
// Borrowed from rwmutex_test.go
|
||||
func reader(resource string, numIterations int, activity *int32, cdone chan bool) {
|
||||
rwm := NewDRWMutex(ds, resource)
|
||||
for i := 0; i < numIterations; i++ {
|
||||
for range numIterations {
|
||||
if rwm.GetRLock(context.Background(), nil, id, source, Options{Timeout: time.Second}) {
|
||||
n := atomic.AddInt32(activity, 1)
|
||||
if n < 1 || n >= 10000 {
|
||||
panic(fmt.Sprintf("wlock(%d)\n", n))
|
||||
}
|
||||
for i := 0; i < 100; i++ {
|
||||
for range 100 {
|
||||
}
|
||||
atomic.AddInt32(activity, -1)
|
||||
rwm.RUnlock(context.Background())
|
||||
@@ -202,13 +202,13 @@ func reader(resource string, numIterations int, activity *int32, cdone chan bool
|
||||
// Borrowed from rwmutex_test.go
|
||||
func writer(resource string, numIterations int, activity *int32, cdone chan bool) {
|
||||
rwm := NewDRWMutex(ds, resource)
|
||||
for i := 0; i < numIterations; i++ {
|
||||
for range numIterations {
|
||||
if rwm.GetLock(context.Background(), nil, id, source, Options{Timeout: time.Second}) {
|
||||
n := atomic.AddInt32(activity, 10000)
|
||||
if n != 10000 {
|
||||
panic(fmt.Sprintf("wlock(%d)\n", n))
|
||||
}
|
||||
for i := 0; i < 100; i++ {
|
||||
for range 100 {
|
||||
}
|
||||
atomic.AddInt32(activity, -10000)
|
||||
rwm.Unlock(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user