MCPcopy Create free account
hub / github.com/github/gh-aw / expandIncludesIteratively

Function expandIncludesIteratively

pkg/parser/include_expander.go:62–81  ·  view source on GitHub ↗
(content, baseDir string, extractTools bool)

Source from the content-addressed store, hash-verified

60}
61
62func expandIncludesIteratively(content, baseDir string, extractTools bool) (string, map[string]struct {
63}, error) {
64 const maxDepth = 10
65 currentContent := content
66 visited := make(map[string]struct {
67 })
68 for depth := range maxDepth {
69 includeExpanderLog.Printf("Include expansion depth: %d", depth)
70 processedContent, err := processIncludesWithVisited(currentContent, baseDir, extractTools, visited)
71 if err != nil {
72 return "", nil, err
73 }
74 if includeExpansionComplete(currentContent, processedContent, extractTools) {
75 currentContent = processedContent
76 break
77 }
78 currentContent = processedContent
79 }
80 return currentContent, visited, nil
81}
82
83func includeExpansionComplete(currentContent, processedContent string, extractTools bool) bool {
84 if extractTools {

Callers 1

Calls 3

includeExpansionCompleteFunction · 0.85
PrintfMethod · 0.45

Tested by

no test coverage detected