Address linting issues in addrs package (#2777)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2025-05-09 14:50:37 -04:00
committed by GitHub
parent ae542df787
commit 5fdf66c943
3 changed files with 6 additions and 6 deletions

View File

@@ -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()
}
}

View File

@@ -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()
}
}

View File

@@ -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.