Open mvrahden opened 1 year ago
I believe the linter fails on detecting os.Setenv calls in more advanced scenarios. Here's one:
os.Setenv
func TestModelSuite(t *testing.T) { suite.Run(t, &MySuite{}) } func (s *MySuite) SetupTest() { // ... some setup code s.NoError(os.Setenv("AWS_XRAY_SDK_DISABLED", "true")) // want "some linting error to detect this" // ... more setup code }
FIY: The test suite here is from stretchr/testify should that help you pinpoint the issue.
stretchr/testify
The solution should look like this:
s.T().Setenv("AWS_XRAY_SDK_DISABLED", "true")
As you can see, T() will return the *testing.T instance. So your linter should be sensible to this case as well :)
T()
*testing.T
And just for clarity: I have the configuration parameter all set to true
all
true
Are you still annoyed with this problem? If so, I'll take the time to resolve this issue.
I believe the linter fails on detecting
os.Setenv
calls in more advanced scenarios. Here's one:FIY: The test suite here is from
stretchr/testify
should that help you pinpoint the issue.The solution should look like this:
As you can see,
T()
will return the*testing.T
instance. So your linter should be sensible to this case as well :)And just for clarity: I have the configuration parameter
all
set totrue