Skip to content

Commit

Permalink
sort items before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Fowler committed Jul 18, 2023
1 parent 546f3c2 commit e23ed6d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/app/cf-terraforming/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,16 @@ func writeAttrLine(key string, value interface{}, parentName string, body *hclwr
}
}
if len(stringItems) > 0 {
sort.Slice(stringItems, func(i, j int) bool {
return stringItems[i] < stringItems[j]
})
writeAttrLine(key, stringItems, parentName, body)
}

if len(intItems) > 0 {
sort.Slice(intItems, func(i, j int) bool {
return intItems[i] < intItems[j]
})
writeAttrLine(key, intItems, parentName, body)
}

Expand Down

0 comments on commit e23ed6d

Please sign in to comment.