@@ -79,17 +79,19 @@ func processContextPaths(workDir string, paths []string) string {
7979 }
8080 if !d.IsDir() {
8181 // Check if we've already processed this file (case-insensitive)
82− processedMutex.Lock()
8382 lowerPath := strings.ToLower(path)
84− if !processedFiles[lowerPath] {
83+
84+ processedMutex.Lock()
85+ alreadyProcessed := processedFiles[lowerPath]
86+ if !alreadyProcessed {
8587 processedFiles[lowerPath] = true
86− processedMutex.Unlock()
88+ }
89+ processedMutex.Unlock()
8790
91+ if !alreadyProcessed {
8892 if result := processFile(path); result != "" {
8993 resultCh <- result
9094 }
91− } else {
92− processedMutex.Unlock()
9395 }
9496 }
9597 return nil
@@ -98,18 +100,20 @@ func processContextPaths(workDir string, paths []string) string {
98100 fullPath := filepath.Join(workDir, p)
99101
100102 // Check if we've already processed this file (case-insensitive)
101− processedMutex.Lock()
102103 lowerPath := strings.ToLower(fullPath)
103− if !processedFiles[lowerPath] {
104+
105+ processedMutex.Lock()
106+ alreadyProcessed := processedFiles[lowerPath]
107+ if !alreadyProcessed {
104108 processedFiles[lowerPath] = true
105− processedMutex.Unlock()
109+ }
110+ processedMutex.Unlock()
106111
112+ if !alreadyProcessed {
107113 result := processFile(fullPath)
108114 if result != "" {
109115 resultCh <- result
110116 }
111− } else {
112− processedMutex.Unlock()
113117 }
114118 }
115119 }(path)