Skip to content

Commit 12ecf53

Browse files
committed
refactor comments
1 parent 613f194 commit 12ecf53

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

internal/convert/adv2v2.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,32 +198,25 @@ func copyAttributesSorted(targetBody *hclwrite.Body, sourceAttrs map[string]*hcl
198198
}
199199

200200
func processAllSpecs(body *hclwrite.Body, diskSizeGB hclwrite.Tokens) {
201-
// Process specs that need diskSizeGB
202201
specsWithDisk := []string{nElectableSpecs, nReadOnlySpecs, nAnalyticsSpecs}
203202
for _, spec := range specsWithDisk {
204203
fillSpecOpt(body, spec, diskSizeGB)
205204
}
206-
// Process specs without diskSizeGB
207205
specsWithoutDisk := []string{nAutoScaling, nAnalyticsAutoScaling}
208206
for _, spec := range specsWithoutDisk {
209207
fillSpecOpt(body, spec, nil)
210208
}
211209
}
212210

213211
func processConfigForDynamicBlock(configBlockb *hclwrite.Body, diskSizeGB hclwrite.Tokens) *hclwrite.Body {
214-
// Create a new body with sorted attributes
215212
newConfigBody := hclwrite.NewEmptyFile().Body()
216-
217-
// Copy attributes in the expected order (priority, provider_name, region_name first)
218213
attrs := configBlockb.Attributes()
219214
orderedAttrs := []string{nPriority, nProviderName, nRegionName}
220215
for _, attrName := range orderedAttrs {
221216
if attr := attrs[attrName]; attr != nil {
222217
newConfigBody.SetAttributeRaw(attrName, attr.Expr().BuildTokens(nil))
223218
}
224219
}
225-
226-
// Process spec blocks and convert them to attributes
227220
for _, block := range configBlockb.Blocks() {
228221
blockType := block.Type()
229222
blockBody := hclwrite.NewEmptyFile().Body()
@@ -234,7 +227,6 @@ func processConfigForDynamicBlock(configBlockb *hclwrite.Body, diskSizeGB hclwri
234227
}
235228
newConfigBody.SetAttributeRaw(blockType, hcl.TokensObject(blockBody))
236229
}
237-
238230
return newConfigBody
239231
}
240232

internal/convert/shared.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ func setKeyValue(body *hclwrite.Body, key, value *hclwrite.Attribute) {
296296
keyStr, err := hcl.GetAttrString(key)
297297
if err == nil {
298298
if !hclsyntax.ValidIdentifier(keyStr) {
299-
// wrap in quotes so invalid identifiers (e.g. with blanks) can be used as attribute names
299+
// Wrap in quotes so invalid identifiers (e.g. with blanks) can be used as attribute names
300300
keyStr = strconv.Quote(keyStr)
301301
}
302302
} else {
303303
keyStr = strings.TrimSpace(string(key.Expr().BuildTokens(nil).Bytes()))
304-
keyStr = "(" + keyStr + ")" // wrap in parentheses so non-literal expressions can be used as attribute names
304+
keyStr = "(" + keyStr + ")" // Wrap in parentheses so non-literal expressions can be used as attribute names
305305
}
306306
body.SetAttributeRaw(keyStr, value.Expr().BuildTokens(nil))
307307
}

0 commit comments

Comments
 (0)