aboutsummaryrefslogtreecommitdiff
path: root/internal/scanner/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/scanner/scanner.go')
-rw-r--r--internal/scanner/scanner.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go
index 68ef4ba..ec85628 100644
--- a/internal/scanner/scanner.go
+++ b/internal/scanner/scanner.go
@@ -24,7 +24,8 @@ func New(roots []string) *Scanner {
//
// The returned slice is not guaranteed to be sorted.
func (s *Scanner) Scan(ctx context.Context) ([]File, error) {
- var files []File
+ files := make([]File, 0)
+ seen := make(map[string]struct{})
for _, root := range s.roots {
discovered, err := s.walk(ctx, root)
@@ -32,7 +33,14 @@ func (s *Scanner) Scan(ctx context.Context) ([]File, error) {
return nil, err
}
- files = append(files, discovered...)
+ for _, file := range discovered {
+ if _, ok := seen[file.Path]; ok {
+ continue
+ }
+
+ seen[file.Path] = struct{}{}
+ files = append(files, file)
+ }
}
return files, nil