From 3ad502657ffbec974a40c0f2b092d8ad59e703b9 Mon Sep 17 00:00:00 2001 From: Jared Hatfield Date: Sat, 30 May 2026 09:37:41 -0400 Subject: [PATCH] apply go fix --- internal/configuration/configuration.go | 18 +++++++++--------- internal/query/execute.go | 13 +++++-------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/internal/configuration/configuration.go b/internal/configuration/configuration.go index 6b327c7..638d804 100644 --- a/internal/configuration/configuration.go +++ b/internal/configuration/configuration.go @@ -8,19 +8,19 @@ import ( // Node represents a system component type Node struct { - ID string `yaml:"id"` - Type string `yaml:"type"` - Parent string `yaml:"parent,omitempty"` - Attributes map[string]interface{} `yaml:"attributes,omitempty"` + ID string `yaml:"id"` + Type string `yaml:"type"` + Parent string `yaml:"parent,omitempty"` + Attributes map[string]any `yaml:"attributes,omitempty"` } // Link represents an interaction between nodes type Link struct { - ID string `yaml:"-"` - Source string `yaml:"source"` - Target string `yaml:"target"` - Type string `yaml:"type"` - Attributes map[string]interface{} `yaml:"attributes,omitempty"` + ID string `yaml:"-"` + Source string `yaml:"source"` + Target string `yaml:"target"` + Type string `yaml:"type"` + Attributes map[string]any `yaml:"attributes,omitempty"` } // Config holds the aggregated architecture diff --git a/internal/query/execute.go b/internal/query/execute.go index af48598..3682848 100644 --- a/internal/query/execute.go +++ b/internal/query/execute.go @@ -2,6 +2,7 @@ package query import ( "fmt" + "slices" "github.com/UnitVectorY-Labs/YAMLtecture/internal/configuration" ) @@ -325,10 +326,8 @@ func isChildOf(nodeID string, targetNodeID string, ctx *ConfigContext) (bool, er } // Check if nodeID is a direct child of targetNodeID - for _, childID := range ctx.ChildrenMap[targetNodeID] { - if childID == nodeID { - return true, nil - } + if slices.Contains(ctx.ChildrenMap[targetNodeID], nodeID) { + return true, nil } // If we get here, nodeID is not a child of targetNodeID @@ -365,10 +364,8 @@ func isDescendantOf(nodeID string, targetNodeID string, ctx *ConfigContext) (boo } // Check direct children first - for _, childID := range children { - if childID == nodeID { - return true, nil - } + if slices.Contains(children, nodeID) { + return true, nil } // If not found in direct children, check deeper descendants