Invalidate removes a source map from cache (called after file changes)
(goFilePath string)
| 119 | |
| 120 | // Invalidate removes a source map from cache (called after file changes) |
| 121 | func (c *SourceMapCache) Invalidate(goFilePath string) { |
| 122 | dingoPath := strings.TrimSuffix(goFilePath, ".go") + ".dingo" |
| 123 | dmapPath := strings.TrimSuffix(dingoPath, ".dingo") + ".dmap" |
| 124 | |
| 125 | c.mu.Lock() |
| 126 | defer c.mu.Unlock() |
| 127 | |
| 128 | // CRITICAL FIX C3: Use dingoPath as key (consistent with Get()) |
| 129 | if reader, ok := c.maps[dingoPath]; ok { |
| 130 | reader.Close() // Release resources (currently no-op, but future-proofs for mmap) |
| 131 | delete(c.maps, dingoPath) |
| 132 | c.logger.Debugf("Source map invalidated: %s", dmapPath) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // InvalidateAll clears the entire cache |
| 137 | func (c *SourceMapCache) InvalidateAll() { |