Warn less about flag

This commit is contained in:
Mike Farah 2025-07-22 10:02:27 +10:00
parent 70ac3d6c7a
commit f35e57d901
2 changed files with 8 additions and 3 deletions

View File

@ -6,6 +6,8 @@ import (
"slices"
)
var showMergeAnchorToSpecWarning = true
func assignAliasOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
log.Debugf("AssignAlias operator!")
@ -159,8 +161,9 @@ func reconstructAliasedMap(node *CandidateNode, context Context) error {
}
}
}
} else {
} else if showMergeAnchorToSpecWarning {
log.Warning("--yaml-fix-merge-anchor-to-spec is false; causing merge anchors to override the existing values which isn't to the yaml spec. This flag will default to true in late 2025.")
showMergeAnchorToSpecWarning = false
}
for index := 0; index < len(node.Content); index = index + 2 {

View File

@ -283,8 +283,6 @@ func doTraverseMap(newMatches *orderedmap.OrderedMap, node *CandidateNode, wante
}
}
}
} else {
log.Warning("--yaml-fix-merge-anchor-to-spec is false; causing merge anchors to override the existing values which isn't to the yaml spec. This flag will default to true in late 2025.")
}
}
@ -296,6 +294,10 @@ func doTraverseMap(newMatches *orderedmap.OrderedMap, node *CandidateNode, wante
if key.Tag == "!!merge" && !prefs.DontFollowAlias && wantedKey != key.Value {
if !ConfiguredYamlPreferences.FixMergeAnchorToSpec {
log.Debug("Merge anchor")
if showMergeAnchorToSpecWarning {
log.Warning("--yaml-fix-merge-anchor-to-spec is false; causing merge anchors to override the existing values which isn't to the yaml spec. This flag will default to true in late 2025.")
showMergeAnchorToSpecWarning = false
}
err := traverseMergeAnchor(newMatches, value, wantedKey, prefs, splat)
if err != nil {
return err