use //nolint: comment instead of central config

This more precise, only affects a given line and not all matching lines.
This commit is contained in:
Denis Bilenko 2024-12-04 14:55:27 +01:00
parent 0027c654f1
commit d4d0a36087
3 changed files with 2 additions and 5 deletions

View File

@ -17,7 +17,3 @@ linters-settings:
replacement: 'a[b:]'
issues:
exclude-dirs-use-default: false # recommended by docs https://golangci-lint.run/usage/false-positives/
exclude:
# Excluded because they are currently failing. Once fixed, these exceptions should be removed from here:
- "SA1019: tfexec.State is deprecated: The -state CLI flag is a legacy flag and should not be used. If you need a different state file for every run, you can instead use the local backend. See https://github.com/hashicorp/terraform/issues/25920#issuecomment-676560799"
- "SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use"

View File

@ -57,6 +57,7 @@ func (m *importResource) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
tf.SetStdout(buf)
//lint:ignore SA1019 We use legacy -state flag for now to plan the import changes based on temporary state file
//nolint:staticcheck
changed, err := tf.Plan(ctx, tfexec.State(tmpState), tfexec.Target(importAddress))
if err != nil {
return diag.Errorf("terraform plan: %v", err)

View File

@ -251,7 +251,7 @@ func (t *cobraTestRunner) RunBackground() {
// These commands are globals so we have to clean up to the best of our ability after each run.
// See https://github.com/spf13/cobra/blob/a6f198b635c4b18fff81930c40d464904e55b161/command.go#L1062-L1066
//lint:ignore SA1012 cobra sets the context and doesn't clear it
cli.SetContext(nil)
cli.SetContext(nil) //nolint:staticcheck
// Make caller aware of error.
errch <- err