testifylint
testifylint copied to clipboard
autofixing assert.True -> assert.GreaterOrEqual can break working tests
Running the autofix via golangci-lint will convert this code:
elapsed := time.Minute
assert.True(t, elapsed.Seconds() >= 1)
into this code.
elapsed := time.Minute
assert.GreaterOrEqual(t, elapsed.Seconds(), 1)
However this "fix" introduces a testify error Elements should be the same type.
I think this particular category of fixes should be removed as it can break working tests.
A working implementation of this fix would have to analyze the return value of function's passed into testify compare functions and emit code such as assert.GreaterOrEqual(t, elapsed.Seconds(), float64(1)).