hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

golangci - enable tenv linter and swap os.SetEnv to correct t.SetEnv & enabled #28005

Open katbyte opened 6 days ago

katbyte commented 6 days ago

This pull request refactors the code to replace instances of os.Setenv with t.Setenv in test files. The t.Setenv method, introduced in Go 1.17, is specifically designed for managing environment variables in tests, ensuring they are properly cleaned up after each test case. currently both are in use within the provider and this aligns them with the correct methold.

attempted to enable nilerr to enforce a nolint directive & a comment explaining why the error is being ignored, however linter does not seem to respect nolint director so left comments and disabled linter

also tidy up the golangci config file

This is a (please select all that apply):

Related Issue(s)

Fixes #0000

[!NOTE] If this PR changes meaningfully during the course of review please update the title and description as required.