From 5fdf66c9436ff367dff429f788c075a28aa4e701 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Fri, 9 May 2025 14:50:37 -0400 Subject: [PATCH] Address linting issues in addrs package (#2777) Signed-off-by: Christian Mesh --- internal/addrs/module_instance_test.go | 4 ++-- internal/addrs/module_test.go | 4 ++-- internal/addrs/parse_target.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/addrs/module_instance_test.go b/internal/addrs/module_instance_test.go index 5da6d4433c..23cdbc5603 100644 --- a/internal/addrs/module_instance_test.go +++ b/internal/addrs/module_instance_test.go @@ -206,14 +206,14 @@ func TestIsForModule(t *testing.T) { func BenchmarkStringShort(b *testing.B) { addr, _ := ParseModuleInstanceStr(`module.foo`) for n := 0; n < b.N; n++ { - addr.String() + _ = addr.String() } } func BenchmarkStringLong(b *testing.B) { addr, _ := ParseModuleInstanceStr(`module.southamerica-brazil-region.module.user-regional-desktops.module.user-name`) for n := 0; n < b.N; n++ { - addr.String() + _ = addr.String() } } diff --git a/internal/addrs/module_test.go b/internal/addrs/module_test.go index d07b1af3a6..42f9403b22 100644 --- a/internal/addrs/module_test.go +++ b/internal/addrs/module_test.go @@ -93,14 +93,14 @@ func TestModuleString(t *testing.T) { func BenchmarkModuleStringShort(b *testing.B) { module := Module{"a", "b"} for n := 0; n < b.N; n++ { - module.String() + _ = module.String() } } func BenchmarkModuleStringLong(b *testing.B) { module := Module{"southamerica-brazil-region", "user-regional-desktop", "user-name"} for n := 0; n < b.N; n++ { - module.String() + _ = module.String() } } diff --git a/internal/addrs/parse_target.go b/internal/addrs/parse_target.go index 5c770632a9..64618033b1 100644 --- a/internal/addrs/parse_target.go +++ b/internal/addrs/parse_target.go @@ -51,8 +51,8 @@ func ParseTarget(traversal hcl.Traversal) (*Target, tfdiags.Diagnostics) { } var subject Targetable - switch { - case riAddr.Resource.Key == NoKey: + switch riAddr.Resource.Key { + case NoKey: // We always assume that a no-key instance is meant to // be referring to the whole resource, because the distinction // doesn't really matter for targets anyway.