mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 02:03:24 +08:00
Multiply, substract with custom types
This commit is contained in:
+25
-2
@@ -190,9 +190,32 @@ func recurseNodeObjectEqual(lhs *yaml.Node, rhs *yaml.Node) bool {
|
||||
}
|
||||
|
||||
func recursiveNodeEqual(lhs *yaml.Node, rhs *yaml.Node) bool {
|
||||
if lhs.Kind != rhs.Kind || lhs.Tag != rhs.Tag {
|
||||
if lhs.Kind != rhs.Kind {
|
||||
return false
|
||||
} else if lhs.Tag == "!!null" {
|
||||
}
|
||||
|
||||
if lhs.Kind == yaml.ScalarNode {
|
||||
//process custom tags of scalar nodes.
|
||||
//dont worry about matching tags of maps or arrays.
|
||||
|
||||
lhsTag := lhs.Tag
|
||||
rhsTag := rhs.Tag
|
||||
if !strings.HasPrefix(lhsTag, "!!") {
|
||||
// custom tag - we have to have a guess
|
||||
lhsTag = guessTagFromCustomType(lhs)
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(rhsTag, "!!") {
|
||||
// custom tag - we have to have a guess
|
||||
rhsTag = guessTagFromCustomType(rhs)
|
||||
}
|
||||
|
||||
if lhsTag != rhsTag {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if lhs.Tag == "!!null" {
|
||||
return true
|
||||
|
||||
} else if lhs.Kind == yaml.ScalarNode {
|
||||
|
||||
Reference in New Issue
Block a user