Skip to content

Commit c0552ec

Browse files
committed
extract comments to const
1 parent d0617be commit c0552ec

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

internal/convert/convert.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,16 @@ const (
2323
valClusterType = "REPLICASET"
2424
valMaxPriority = 7
2525
valMinPriority = 1
26-
errFreeCluster = "free cluster (because no " + nRepSpecs + ")"
27-
errRepSpecs = "setting " + nRepSpecs
28-
errConfigs = "setting " + nConfig
29-
errPriority = "setting " + nPriority
30-
errNumShards = "setting " + nNumShards
26+
27+
errFreeCluster = "free cluster (because no " + nRepSpecs + ")"
28+
errRepSpecs = "setting " + nRepSpecs
29+
errConfigs = "setting " + nConfig
30+
errPriority = "setting " + nPriority
31+
errNumShards = "setting " + nNumShards
32+
33+
commentGeneratedBy = "Generated by atlas-cli-plugin-terraform."
34+
commentConfirmReferences = "Please confirm that all references to this resource are updated."
35+
commentMovedBlock = "Moved blocks"
3136
)
3237

3338
type attrVals struct {
@@ -62,8 +67,8 @@ func ClusterToAdvancedCluster(config []byte, includeMoved bool) ([]byte, error)
6267
if convertedResource || convertedDataSource {
6368
blockb := block.Body()
6469
blockb.AppendNewline()
65-
hcl.AppendComment(blockb, "Generated by atlas-cli-plugin-terraform.")
66-
hcl.AppendComment(blockb, "Please confirm that all references to this resource are updated.")
70+
hcl.AppendComment(blockb, commentGeneratedBy)
71+
hcl.AppendComment(blockb, commentConfirmReferences)
6772
}
6873
}
6974
fillMovedBlocks(parserb, moveLabels)
@@ -113,7 +118,7 @@ func fillMovedBlocks(body *hclwrite.Body, moveLabels []string) {
113118
return
114119
}
115120
body.AppendNewline()
116-
hcl.AppendComment(body, "Moved blocks")
121+
hcl.AppendComment(body, commentMovedBlock)
117122
body.AppendNewline()
118123
for i, moveLabel := range moveLabels {
119124
block := body.AppendNewBlock(nMoved, nil)

0 commit comments

Comments
 (0)