exportloopref: deprecation (#4916)
This commit is contained in:
		
							parent
							
								
									af298e1e82
								
							
						
					
					
						commit
						87dd8fe755
					
				@ -106,15 +106,16 @@ linters:
 | 
				
			|||||||
  disable-all: true
 | 
					  disable-all: true
 | 
				
			||||||
  enable:
 | 
					  enable:
 | 
				
			||||||
    - bodyclose
 | 
					    - bodyclose
 | 
				
			||||||
 | 
					    - copyloopvar
 | 
				
			||||||
    - depguard
 | 
					    - depguard
 | 
				
			||||||
    - dogsled
 | 
					    - dogsled
 | 
				
			||||||
    - dupl
 | 
					    - dupl
 | 
				
			||||||
    - errcheck
 | 
					    - errcheck
 | 
				
			||||||
    - errorlint
 | 
					    - errorlint
 | 
				
			||||||
    - exportloopref
 | 
					 | 
				
			||||||
    - funlen
 | 
					    - funlen
 | 
				
			||||||
    - gocheckcompilerdirectives
 | 
					    - gocheckcompilerdirectives
 | 
				
			||||||
    - gochecknoinits
 | 
					    - gochecknoinits
 | 
				
			||||||
 | 
					    - gochecknoinits
 | 
				
			||||||
    - goconst
 | 
					    - goconst
 | 
				
			||||||
    - gocritic
 | 
					    - gocritic
 | 
				
			||||||
    - gocyclo
 | 
					    - gocyclo
 | 
				
			||||||
@ -126,6 +127,7 @@ linters:
 | 
				
			|||||||
    - gosec
 | 
					    - gosec
 | 
				
			||||||
    - gosimple
 | 
					    - gosimple
 | 
				
			||||||
    - govet
 | 
					    - govet
 | 
				
			||||||
 | 
					    - intrange
 | 
				
			||||||
    - ineffassign
 | 
					    - ineffassign
 | 
				
			||||||
    - lll
 | 
					    - lll
 | 
				
			||||||
    - misspell
 | 
					    - misspell
 | 
				
			||||||
 | 
				
			|||||||
@ -140,7 +140,6 @@ func printValidationDetail(cmd *cobra.Command, detail *jsonschema.Detailed) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, d := range detail.Errors {
 | 
						for _, d := range detail.Errors {
 | 
				
			||||||
		d := d
 | 
					 | 
				
			||||||
		printValidationDetail(cmd, &d)
 | 
							printValidationDetail(cmd, &d)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -63,7 +63,6 @@ func Test_createSchemaURL(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -126,7 +125,6 @@ func Test_createSchemaURL_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,6 @@ func Test_sanitizeVersion(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,6 @@ func TestConfiguration_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -115,7 +114,6 @@ func TestConfiguration_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -76,7 +76,6 @@ func TestIsGoGreaterThanOrEqual(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -124,7 +123,6 @@ func Test_trimGoVersion(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -121,7 +121,6 @@ func TestExcludeRule_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -194,7 +193,6 @@ func TestExcludeRule_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,6 @@ func TestLintersSettings_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -74,7 +73,6 @@ func TestLintersSettings_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -112,7 +110,6 @@ func TestCustomLinterSettings_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -144,7 +141,6 @@ func TestCustomLinterSettings_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -181,7 +177,6 @@ func TestGovetSettings_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -224,7 +219,6 @@ func TestGovetSettings_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -77,7 +76,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -138,7 +136,6 @@ func TestLinters_validateAllDisableEnableOptions(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -201,7 +198,6 @@ func TestLinters_validateAllDisableEnableOptions_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,6 @@ func TestOutput_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -95,7 +94,6 @@ func TestOutput_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -133,7 +131,6 @@ func TestOutputFormat_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -164,7 +161,6 @@ func TestOutputFormat_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,6 @@ func TestRun_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -64,7 +63,6 @@ func TestRun_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,6 @@ func TestSeverity_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,7 +95,6 @@ func TestSeverity_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -194,7 +192,6 @@ func TestSeverityRule_Validate_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -25,8 +25,6 @@ func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]resu
 | 
				
			|||||||
	var other error
 | 
						var other error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, err := range errs {
 | 
						for _, err := range errs {
 | 
				
			||||||
		err := err
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		var ill *IllTypedError
 | 
							var ill *IllTypedError
 | 
				
			||||||
		if !errors.As(err, &ill) {
 | 
							if !errors.As(err, &ill) {
 | 
				
			||||||
			if other == nil {
 | 
								if other == nil {
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,6 @@ func Test_stackCrusher(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -475,7 +475,7 @@ func sizeOfReflectValueTreeBytes(rv reflect.Value, visitedPtrs map[uintptr]struc
 | 
				
			|||||||
		return sizeOfReflectValueTreeBytes(rv.Elem(), visitedPtrs)
 | 
							return sizeOfReflectValueTreeBytes(rv.Elem(), visitedPtrs)
 | 
				
			||||||
	case reflect.Struct:
 | 
						case reflect.Struct:
 | 
				
			||||||
		ret := 0
 | 
							ret := 0
 | 
				
			||||||
		for i := 0; i < rv.NumField(); i++ {
 | 
							for i := range rv.NumField() {
 | 
				
			||||||
			ret += sizeOfReflectValueTreeBytes(rv.Field(i), visitedPtrs)
 | 
								ret += sizeOfReflectValueTreeBytes(rv.Field(i), visitedPtrs)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return ret
 | 
							return ret
 | 
				
			||||||
 | 
				
			|||||||
@ -205,7 +205,7 @@ func loadIssuesFromCache(pkgs []*packages.Package, lintCtx *linter.Context,
 | 
				
			|||||||
	wg.Add(workerCount)
 | 
						wg.Add(workerCount)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pkgCh := make(chan *packages.Package, len(pkgs))
 | 
						pkgCh := make(chan *packages.Package, len(pkgs))
 | 
				
			||||||
	for i := 0; i < workerCount; i++ {
 | 
						for range workerCount {
 | 
				
			||||||
		go func() {
 | 
							go func() {
 | 
				
			||||||
			defer wg.Done()
 | 
								defer wg.Done()
 | 
				
			||||||
			for pkg := range pkgCh {
 | 
								for pkg := range pkgCh {
 | 
				
			||||||
 | 
				
			|||||||
@ -262,7 +262,6 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, tt := range cases {
 | 
						for _, tt := range cases {
 | 
				
			||||||
		tt := tt
 | 
					 | 
				
			||||||
		t.Run(tt.name, func(t *testing.T) {
 | 
							t.Run(tt.name, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -434,7 +433,6 @@ func Test_settingsWrapper_Validate(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, tt := range cases {
 | 
						for _, tt := range cases {
 | 
				
			||||||
		tt := tt
 | 
					 | 
				
			||||||
		t.Run(tt.name, func(t *testing.T) {
 | 
							t.Run(tt.name, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,6 @@ func Test_toGosecConfig(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -242,7 +242,6 @@ func ExtractIssuesFromPatch(patch string, lintCtx *linter.Context, linterName st
 | 
				
			|||||||
			changes := p.parse(hunk)
 | 
								changes := p.parse(hunk)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for _, change := range changes {
 | 
								for _, change := range changes {
 | 
				
			||||||
				change := change // fix scope
 | 
					 | 
				
			||||||
				i := result.Issue{
 | 
									i := result.Issue{
 | 
				
			||||||
					FromLinter: linterName,
 | 
										FromLinter: linterName,
 | 
				
			||||||
					Pos: token.Position{
 | 
										Pos: token.Position{
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,6 @@ func Test_appendExtraWords_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -209,7 +209,6 @@ func foo() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								pkg/golinters/thelper/testdata/thelper.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								pkg/golinters/thelper/testdata/thelper.go
									
									
									
									
										vendored
									
									
								
							@ -52,7 +52,6 @@ func TestSubtestShouldNotBeChecked(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -278,7 +278,8 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
 | 
				
			|||||||
			WithSince("v1.28.0").
 | 
								WithSince("v1.28.0").
 | 
				
			||||||
			WithPresets(linter.PresetBugs).
 | 
								WithPresets(linter.PresetBugs).
 | 
				
			||||||
			WithLoadForGoAnalysis().
 | 
								WithLoadForGoAnalysis().
 | 
				
			||||||
			WithURL("https://github.com/kyoh86/exportloopref"),
 | 
								WithURL("https://github.com/kyoh86/exportloopref").
 | 
				
			||||||
 | 
								DeprecatedWarning("Since Go1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		linter.NewConfig(forbidigo.New(&cfg.LintersSettings.Forbidigo)).
 | 
							linter.NewConfig(forbidigo.New(&cfg.LintersSettings.Forbidigo)).
 | 
				
			||||||
			WithSince("v1.34.0").
 | 
								WithSince("v1.34.0").
 | 
				
			||||||
 | 
				
			|||||||
@ -43,8 +43,6 @@ func (b *PluginGoBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
 | 
				
			|||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		settings := settings
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		lc, err := b.loadConfig(cfg, name, &settings)
 | 
							lc, err := b.loadConfig(cfg, name, &settings)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("unable to load custom analyzer %q: %s, %w", name, settings.Path, err)
 | 
								return nil, fmt.Errorf("unable to load custom analyzer %q: %s, %w", name, settings.Path, err)
 | 
				
			||||||
 | 
				
			|||||||
@ -162,7 +162,6 @@ func (m *Manager) build(enabledByDefaultLinters []*linter.Config) map[string]*li
 | 
				
			|||||||
	// --presets can only add linters to default set
 | 
						// --presets can only add linters to default set
 | 
				
			||||||
	for _, p := range m.cfg.Linters.Presets {
 | 
						for _, p := range m.cfg.Linters.Presets {
 | 
				
			||||||
		for _, lc := range m.GetAllLinterConfigsForPreset(p) {
 | 
							for _, lc := range m.GetAllLinterConfigsForPreset(p) {
 | 
				
			||||||
			lc := lc
 | 
					 | 
				
			||||||
			resultLintersSet[lc.Name()] = lc
 | 
								resultLintersSet[lc.Name()] = lc
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -149,7 +149,6 @@ func TestManager_build(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, c := range cases {
 | 
						for _, c := range cases {
 | 
				
			||||||
		c := c
 | 
					 | 
				
			||||||
		t.Run(c.name, func(t *testing.T) {
 | 
							t.Run(c.name, func(t *testing.T) {
 | 
				
			||||||
			m, err := NewManager(logutils.NewStderrLog("skip"), &config.Config{Linters: c.cfg}, NewLinterBuilder())
 | 
								m, err := NewManager(logutils.NewStderrLog("skip"), &config.Config{Linters: c.cfg}, NewLinterBuilder())
 | 
				
			||||||
			require.NoError(t, err)
 | 
								require.NoError(t, err)
 | 
				
			||||||
@ -304,7 +303,6 @@ func TestManager_combineGoAnalysisLinters(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -118,7 +118,6 @@ func TestValidator_Validate(t *testing.T) {
 | 
				
			|||||||
	testCases = append(testCases, validatePresetsTestCases...)
 | 
						testCases = append(testCases, validatePresetsTestCases...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -139,7 +138,6 @@ func TestValidator_Validate_error(t *testing.T) {
 | 
				
			|||||||
	testCases = append(testCases, validatePresetsErrorTestCases...)
 | 
						testCases = append(testCases, validatePresetsErrorTestCases...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -158,7 +156,6 @@ func TestValidator_validateLintersNames(t *testing.T) {
 | 
				
			|||||||
	v := NewValidator(m)
 | 
						v := NewValidator(m)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range validateLintersNamesTestCases {
 | 
						for _, test := range validateLintersNamesTestCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -175,7 +172,6 @@ func TestValidator_validateLintersNames_error(t *testing.T) {
 | 
				
			|||||||
	v := NewValidator(m)
 | 
						v := NewValidator(m)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range validateLintersNamesErrorTestCases {
 | 
						for _, test := range validateLintersNamesErrorTestCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -191,7 +187,6 @@ func TestValidator_validatePresets(t *testing.T) {
 | 
				
			|||||||
	v := NewValidator(nil)
 | 
						v := NewValidator(nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range validatePresetsTestCases {
 | 
						for _, test := range validatePresetsTestCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -205,7 +200,6 @@ func TestValidator_validatePresets_error(t *testing.T) {
 | 
				
			|||||||
	v := NewValidator(nil)
 | 
						v := NewValidator(nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range validatePresetsErrorTestCases {
 | 
						for _, test := range validatePresetsErrorTestCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,6 @@ func Test_buildArgs(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -115,7 +115,6 @@ func (r *Runner) Run(ctx context.Context, linters []*linter.Config) ([]result.Is
 | 
				
			|||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, lc := range linters {
 | 
						for _, lc := range linters {
 | 
				
			||||||
		lc := lc
 | 
					 | 
				
			||||||
		sw.TrackStage(lc.Name(), func() {
 | 
							sw.TrackStage(lc.Name(), func() {
 | 
				
			||||||
			linterIssues, err := r.runLinterSafe(ctx, r.lintCtx, lc)
 | 
								linterIssues, err := r.runLinterSafe(ctx, r.lintCtx, lc)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
@ -189,7 +188,6 @@ func (r *Runner) processLintResults(inIssues []result.Issue) []result.Issue {
 | 
				
			|||||||
	// finalize processors: logging, clearing, no heavy work here
 | 
						// finalize processors: logging, clearing, no heavy work here
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, p := range r.Processors {
 | 
						for _, p := range r.Processors {
 | 
				
			||||||
		p := p
 | 
					 | 
				
			||||||
		sw.TrackStage(p.Name(), func() {
 | 
							sw.TrackStage(p.Name(), func() {
 | 
				
			||||||
			p.Finish()
 | 
								p.Finish()
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
@ -220,7 +218,6 @@ func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, s
 | 
				
			|||||||
	for _, p := range r.Processors {
 | 
						for _, p := range r.Processors {
 | 
				
			||||||
		var newIssues []result.Issue
 | 
							var newIssues []result.Issue
 | 
				
			||||||
		var err error
 | 
							var err error
 | 
				
			||||||
		p := p
 | 
					 | 
				
			||||||
		sw.TrackStage(p.Name(), func() {
 | 
							sw.TrackStage(p.Name(), func() {
 | 
				
			||||||
			newIssues, err = p.Process(issues)
 | 
								newIssues, err = p.Process(issues)
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
				
			|||||||
@ -64,7 +64,6 @@ func TestPrinter_Print_stdout(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -82,7 +82,6 @@ path/to/fileb.go:300:9  another issue
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -110,7 +110,6 @@ path/to/fileb.go:300:9: another issue
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,6 @@ func TestAutogeneratedExclude_isGeneratedFileLax_generated(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, comment := range comments {
 | 
						for _, comment := range comments {
 | 
				
			||||||
		comment := comment
 | 
					 | 
				
			||||||
		t.Run(comment, func(t *testing.T) {
 | 
							t.Run(comment, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -64,7 +63,6 @@ func TestAutogeneratedExclude_isGeneratedFileLax_nonGenerated(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, comment := range comments {
 | 
						for _, comment := range comments {
 | 
				
			||||||
		comment := comment
 | 
					 | 
				
			||||||
		t.Run(comment, func(t *testing.T) {
 | 
							t.Run(comment, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -95,7 +93,6 @@ func TestAutogeneratedExclude_isGeneratedFileStrict(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -183,7 +180,6 @@ func Test_shouldPassIssue(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,7 +232,6 @@ func Test_shouldPassIssue_error(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -64,7 +64,6 @@ func (p ExcludeRules) Process(issues []result.Issue) ([]result.Issue, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return filterIssues(issues, func(issue *result.Issue) bool {
 | 
						return filterIssues(issues, func(issue *result.Issue) bool {
 | 
				
			||||||
		for _, rule := range p.rules {
 | 
							for _, rule := range p.rules {
 | 
				
			||||||
			rule := rule
 | 
					 | 
				
			||||||
			if rule.match(issue, p.files, p.log) {
 | 
								if rule.match(issue, p.files, p.log) {
 | 
				
			||||||
				return false
 | 
									return false
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
				
			|||||||
@ -111,7 +111,6 @@ func TestInvalidIssue_Process(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -183,7 +183,6 @@ func TestNolintInvalidLinterNameWithViolationOnTheSameLine(t *testing.T) {
 | 
				
			|||||||
func TestNolintAliases(t *testing.T) {
 | 
					func TestNolintAliases(t *testing.T) {
 | 
				
			||||||
	p := newTestNolintProcessor(getMockLog())
 | 
						p := newTestNolintProcessor(getMockLog())
 | 
				
			||||||
	for _, line := range []int{47, 49, 51} {
 | 
						for _, line := range []int{47, 49, 51} {
 | 
				
			||||||
		line := line
 | 
					 | 
				
			||||||
		t.Run(fmt.Sprintf("line-%d", line), func(t *testing.T) {
 | 
							t.Run(fmt.Sprintf("line-%d", line), func(t *testing.T) {
 | 
				
			||||||
			processAssertEmpty(t, p, newNolintFileIssue(line, "gosec"))
 | 
								processAssertEmpty(t, p, newNolintFileIssue(line, "gosec"))
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
				
			|||||||
@ -483,7 +483,6 @@ func TestSeverity_transform(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,6 @@ func Test_absDirs(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -194,7 +194,7 @@ func mergeComparators(cmps []*comparator) (*comparator, error) {
 | 
				
			|||||||
		return nil, errors.New("no comparator")
 | 
							return nil, errors.New("no comparator")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := 0; i < len(cmps)-1; i++ {
 | 
						for i := range len(cmps) - 1 {
 | 
				
			||||||
		findComparatorTip(cmps[i]).SetNext(cmps[i+1])
 | 
							findComparatorTip(cmps[i]).SetNext(cmps[i+1])
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -79,8 +79,7 @@ type compareTestCase struct {
 | 
				
			|||||||
func testCompareValues(t *testing.T, cmp *comparator, name string, tests []compareTestCase) {
 | 
					func testCompareValues(t *testing.T, cmp *comparator, name string, tests []compareTestCase) {
 | 
				
			||||||
	t.Parallel()
 | 
						t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := 0; i < len(tests); i++ {
 | 
						for i, test := range tests { //nolint:gocritic // To ignore rangeValCopy rule
 | 
				
			||||||
		test := tests[i]
 | 
					 | 
				
			||||||
		t.Run(fmt.Sprintf("%s(%d)", name, i), func(t *testing.T) {
 | 
							t.Run(fmt.Sprintf("%s(%d)", name, i), func(t *testing.T) {
 | 
				
			||||||
			res := cmp.Compare(&test.a, &test.b)
 | 
								res := cmp.Compare(&test.a, &test.b)
 | 
				
			||||||
			assert.Equal(t, test.expected.String(), res.String())
 | 
								assert.Equal(t, test.expected.String(), res.String())
 | 
				
			||||||
@ -200,8 +199,7 @@ func TestNumericCompare(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	t.Parallel()
 | 
						t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := 0; i < len(tests); i++ {
 | 
						for i, test := range tests {
 | 
				
			||||||
		test := tests[i]
 | 
					 | 
				
			||||||
		t.Run(fmt.Sprintf("%s(%d)", "Numeric Compare", i), func(t *testing.T) {
 | 
							t.Run(fmt.Sprintf("%s(%d)", "Numeric Compare", i), func(t *testing.T) {
 | 
				
			||||||
			res := numericCompare(test.a, test.b)
 | 
								res := numericCompare(test.a, test.b)
 | 
				
			||||||
			assert.Equal(t, test.expected.String(), res.String())
 | 
								assert.Equal(t, test.expected.String(), res.String())
 | 
				
			||||||
@ -267,7 +265,6 @@ func Test_mergeComparators(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -154,7 +154,7 @@ func formatDesc(desc string) string {
 | 
				
			|||||||
func hasSettings(name string) bool {
 | 
					func hasSettings(name string) bool {
 | 
				
			||||||
	tp := reflect.TypeOf(config.LintersSettings{})
 | 
						tp := reflect.TypeOf(config.LintersSettings{})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := 0; i < tp.NumField(); i++ {
 | 
						for i := range tp.NumField() {
 | 
				
			||||||
		if strings.EqualFold(name, tp.Field(i).Name) {
 | 
							if strings.EqualFold(name, tp.Field(i).Name) {
 | 
				
			||||||
			return true
 | 
								return true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -114,7 +114,6 @@ func TestEnabledLinters(t *testing.T) {
 | 
				
			|||||||
	binPath := testshared.InstallGolangciLint(t)
 | 
						binPath := testshared.InstallGolangciLint(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, c := range cases {
 | 
						for _, c := range cases {
 | 
				
			||||||
		c := c
 | 
					 | 
				
			||||||
		t.Run(c.name, func(t *testing.T) {
 | 
							t.Run(c.name, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -144,7 +144,6 @@ func TestCgoWithIssues(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -242,7 +241,6 @@ func TestLineDirective(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -301,7 +299,6 @@ func TestLineDirectiveProcessedFiles(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -349,7 +346,6 @@ func TestSortedResults(t *testing.T) {
 | 
				
			|||||||
	binPath := testshared.InstallGolangciLint(t)
 | 
						binPath := testshared.InstallGolangciLint(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.opt, func(t *testing.T) {
 | 
							t.Run(test.opt, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -437,7 +433,6 @@ func TestConfigFileIsDetected(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -475,7 +470,6 @@ func TestEnableAllFastAndEnableCanCoexist(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -559,7 +553,6 @@ func TestPathPrefix(t *testing.T) {
 | 
				
			|||||||
	binPath := testshared.InstallGolangciLint(t)
 | 
						binPath := testshared.InstallGolangciLint(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			testshared.NewRunnerBuilder(t).
 | 
								testshared.NewRunnerBuilder(t).
 | 
				
			||||||
				WithArgs(test.args...).
 | 
									WithArgs(test.args...).
 | 
				
			||||||
 | 
				
			|||||||
@ -124,7 +124,6 @@ func println(...interface{}) { println() } // want println:"found" "call of prin
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.filename, func(t *testing.T) {
 | 
							t.Run(test.filename, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -72,7 +72,6 @@ func Test_evaluateBuildTags(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -56,8 +56,6 @@ func runFix(t *testing.T, extraArgs ...string) {
 | 
				
			|||||||
	sources := setupTestFix(t)
 | 
						sources := setupTestFix(t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, input := range sources {
 | 
						for _, input := range sources {
 | 
				
			||||||
		input := input
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		t.Run(filepath.Base(input), func(t *testing.T) {
 | 
							t.Run(filepath.Base(input), func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,6 @@ func RunTestSourcesFromDir(t *testing.T, dir string) {
 | 
				
			|||||||
	log.SetLevel(logutils.LogLevelInfo)
 | 
						log.SetLevel(logutils.LogLevelInfo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, source := range sources {
 | 
						for _, source := range sources {
 | 
				
			||||||
		source := source
 | 
					 | 
				
			||||||
		t.Run(filepath.Base(source), func(subTest *testing.T) {
 | 
							t.Run(filepath.Base(source), func(subTest *testing.T) {
 | 
				
			||||||
			subTest.Parallel()
 | 
								subTest.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -167,7 +167,6 @@ func TestRunnerBuilder_Runner(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range testCases {
 | 
						for _, test := range testCases {
 | 
				
			||||||
		test := test
 | 
					 | 
				
			||||||
		t.Run(test.desc, func(t *testing.T) {
 | 
							t.Run(test.desc, func(t *testing.T) {
 | 
				
			||||||
			t.Parallel()
 | 
								t.Parallel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user