From d4d0a36087511709d70b352521f5ba9d78bfec7f Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Wed, 4 Dec 2024 14:55:27 +0100 Subject: [PATCH] use //nolint: comment instead of central config This more precise, only affects a given line and not all matching lines. --- .golangci.yaml | 4 ---- bundle/deploy/terraform/import.go | 1 + internal/helpers.go | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index ec87906d9..ef2596206 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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" diff --git a/bundle/deploy/terraform/import.go b/bundle/deploy/terraform/import.go index dfe60a581..5c2937cd2 100644 --- a/bundle/deploy/terraform/import.go +++ b/bundle/deploy/terraform/import.go @@ -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) diff --git a/internal/helpers.go b/internal/helpers.go index 3e4b4e97c..c203e390d 100644 --- a/internal/helpers.go +++ b/internal/helpers.go @@ -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