Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Dec 11, 2024
1 parent 6452714 commit 27beaed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions internal/pkg/modifiers/comma_space_map_modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

// CommaSpaceMapModifier ensures consistent formatting of comma-separated strings in map values
// CommaSpaceMapModifier ensures consistent formatting of comma-separated strings in map values.
type CommaSpaceMapModifier struct{}

func (m CommaSpaceMapModifier) Description(ctx context.Context) string {
Expand Down Expand Up @@ -41,7 +41,12 @@ func (m CommaSpaceMapModifier) PlanModifyMap(ctx context.Context, req planmodifi
}

for key, value := range planElements {
strValue := value.(types.String)
strValue, ok := value.(types.String)

if !ok {
continue
}

if !strValue.IsNull() && !strValue.IsUnknown() {
parts := strings.Split(strValue.ValueString(), ",")
for i, part := range parts {
Expand Down Expand Up @@ -70,7 +75,7 @@ func (m CommaSpaceMapModifier) PlanModifyMap(ctx context.Context, req planmodifi
resp.PlanValue = newMapValue
}

// CommaSpaceMap returns a new instance of CommaSpaceMapModifier
// CommaSpaceMap returns a new instance of CommaSpaceMapModifier.
func CommaSpaceMap() CommaSpaceMapModifier {
return CommaSpaceMapModifier{}
}
5 changes: 3 additions & 2 deletions internal/provider/resource/identity_oidc_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ func updateOidcAuthStateByApi(ctx context.Context, diagnose diag.Diagnostics, pl
useSpaces := false
if !plan.BoundClaims.IsNull() {
if planValue, ok := plan.BoundClaims.Elements()[key]; ok {
planStr := planValue.(types.String).ValueString()
useSpaces = strings.Contains(planStr, ", ")
if planStr, ok := planValue.(types.String); ok {
useSpaces = strings.Contains(planStr.ValueString(), ", ")
}
}
}

Expand Down

0 comments on commit 27beaed

Please sign in to comment.