mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Run gopls modernize on codebase (#34751)
				
					
				
			Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
This commit is contained in:
		@@ -77,17 +77,17 @@ func TestWorkerPoolQueueUnhandled(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	runCount := 2 // we can run these tests even hundreds times to see its stability
 | 
			
		||||
	t.Run("1/1", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			test(t, setting.QueueSettings{BatchLength: 1, MaxWorkers: 1})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	t.Run("3/1", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			test(t, setting.QueueSettings{BatchLength: 3, MaxWorkers: 1})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	t.Run("4/5", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			test(t, setting.QueueSettings{BatchLength: 4, MaxWorkers: 5})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
@@ -96,17 +96,17 @@ func TestWorkerPoolQueueUnhandled(t *testing.T) {
 | 
			
		||||
func TestWorkerPoolQueuePersistence(t *testing.T) {
 | 
			
		||||
	runCount := 2 // we can run these tests even hundreds times to see its stability
 | 
			
		||||
	t.Run("1/1", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			testWorkerPoolQueuePersistence(t, setting.QueueSettings{BatchLength: 1, MaxWorkers: 1, Length: 100})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	t.Run("3/1", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			testWorkerPoolQueuePersistence(t, setting.QueueSettings{BatchLength: 3, MaxWorkers: 1, Length: 100})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	t.Run("4/5", func(t *testing.T) {
 | 
			
		||||
		for i := 0; i < runCount; i++ {
 | 
			
		||||
		for range runCount {
 | 
			
		||||
			testWorkerPoolQueuePersistence(t, setting.QueueSettings{BatchLength: 4, MaxWorkers: 5, Length: 100})
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
@@ -141,7 +141,7 @@ func testWorkerPoolQueuePersistence(t *testing.T, queueSetting setting.QueueSett
 | 
			
		||||
 | 
			
		||||
		q, _ := newWorkerPoolQueueForTest("pr_patch_checker_test", queueSetting, testHandler, true)
 | 
			
		||||
		stop := runWorkerPoolQueue(q)
 | 
			
		||||
		for i := 0; i < testCount; i++ {
 | 
			
		||||
		for i := range testCount {
 | 
			
		||||
			_ = q.Push("task-" + strconv.Itoa(i))
 | 
			
		||||
		}
 | 
			
		||||
		close(startWhenAllReady)
 | 
			
		||||
@@ -186,7 +186,7 @@ func TestWorkerPoolQueueActiveWorkers(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	q, _ := newWorkerPoolQueueForTest("test-workpoolqueue", setting.QueueSettings{Type: "channel", BatchLength: 1, MaxWorkers: 1, Length: 100}, handler, false)
 | 
			
		||||
	stop := runWorkerPoolQueue(q)
 | 
			
		||||
	for i := 0; i < 5; i++ {
 | 
			
		||||
	for i := range 5 {
 | 
			
		||||
		assert.NoError(t, q.Push(i))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -202,7 +202,7 @@ func TestWorkerPoolQueueActiveWorkers(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	q, _ = newWorkerPoolQueueForTest("test-workpoolqueue", setting.QueueSettings{Type: "channel", BatchLength: 1, MaxWorkers: 3, Length: 100}, handler, false)
 | 
			
		||||
	stop = runWorkerPoolQueue(q)
 | 
			
		||||
	for i := 0; i < 15; i++ {
 | 
			
		||||
	for i := range 15 {
 | 
			
		||||
		assert.NoError(t, q.Push(i))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -274,7 +274,7 @@ func TestWorkerPoolQueueWorkerIdleReset(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	q, _ = newWorkerPoolQueueForTest("test-workpoolqueue", setting.QueueSettings{Type: "channel", BatchLength: 1, MaxWorkers: 2, Length: 100}, handler, false)
 | 
			
		||||
	stop := runWorkerPoolQueue(q)
 | 
			
		||||
	for i := 0; i < 100; i++ {
 | 
			
		||||
	for i := range 100 {
 | 
			
		||||
		assert.NoError(t, q.Push(i))
 | 
			
		||||
	}
 | 
			
		||||
	time.Sleep(500 * time.Millisecond)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user