1
0
Fork 0

Apply standard Go formatting and update project documentation

- Run go fmt on all Go files to ensure consistent formatting
- Add official Go tooling commands to CLAUDE.md for code quality
- Update project status to reflect current implementation state
This commit is contained in:
Andrew Tomaka 2025-06-12 22:01:45 -04:00
parent 1265f9fb07
commit bde7aeed90
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
7 changed files with 104 additions and 72 deletions

View file

@ -40,7 +40,7 @@ type PatternMatcher struct {
func NewPatternMatcher(pattern string) *PatternMatcher {
// Remove trailing slash if present
pattern = strings.TrimSuffix(pattern, "/")
return &PatternMatcher{
pattern: pattern,
matchedDirs: make(map[string]bool),
@ -58,27 +58,27 @@ func (m *PatternMatcher) ShouldInclude(path string, info os.FileInfo) bool {
}
return false // Don't include the directory itself, only files within
}
// For files, check if any parent directory is in the matched set
dir := filepath.Dir(path)
for {
if m.matchedDirs[dir] {
return true
}
// Also check if this directory matches the pattern (in case we haven't seen it yet)
if matched, err := m.dirMatchesPattern(dir); err == nil && matched {
m.matchedDirs[dir] = true
return true
}
parent := filepath.Dir(dir)
if parent == dir || parent == "." {
break
}
dir = parent
}
return false
}
@ -86,26 +86,26 @@ func (m *PatternMatcher) ShouldInclude(path string, info os.FileInfo) bool {
func (m *PatternMatcher) dirMatchesPattern(dirPath string) (bool, error) {
// Get the directory name
dirName := filepath.Base(dirPath)
// For simple patterns (no path separators), just match the directory name
if len(m.patternSegments) == 1 {
return filepath.Match(m.pattern, dirName)
}
// For complex patterns, we need to match the full path segments
pathSegments := strings.Split(dirPath, string(os.PathSeparator))
// Try to match the pattern segments against the path segments
if len(pathSegments) < len(m.patternSegments) {
return false, nil
}
// Check each pattern segment against the corresponding path segment
for i := 0; i < len(m.patternSegments); i++ {
// Start from the end of both slices
patternIdx := len(m.patternSegments) - 1 - i
pathIdx := len(pathSegments) - 1 - i
matched, err := filepath.Match(m.patternSegments[patternIdx], pathSegments[pathIdx])
if err != nil {
return false, err
@ -114,7 +114,7 @@ func (m *PatternMatcher) dirMatchesPattern(dirPath string) (bool, error) {
return false, nil
}
}
return true, nil
}
@ -136,4 +136,4 @@ func (m *CompositeMatcher) ShouldInclude(path string, info os.FileInfo) bool {
}
}
return false
}
}