tenv icon indicating copy to clipboard operation
tenv copied to clipboard

Add support for detecting issues within for loops

Open crobert-1 opened this issue 6 months ago • 0 comments

I added the following test here, and no errors or issues are displayed:

func TestForLoop(t *testing.T) {
	testsetup()
	for i := 0; i < 3; i++ {
		os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `f\\.Setenv\\(\\)` in TestForLoop"
	}
}

The real use case of a for loop would most often be a map of key:value pairs, but a simple loop exposes the lack of issues being reported.

I believe this should be detected and reported as an error in lint.

crobert-1 avatar Jan 10 '24 17:01 crobert-1