Skip to content

Commit 5ae5856

Browse files
Merge pull request #8 from chinmay-sawant/external-recursive-remove-limit
External recursive remove limit
2 parents 73baca2 + 690aceb commit 5ae5856

29 files changed

+1340850
-840
lines changed

README.md

Lines changed: 276 additions & 75 deletions
Large diffs are not rendered by default.

SKIP_FOLDERS.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Skip External Dependencies Feature
2+
3+
This document explains how to use the new `--skip-folders` feature in GoMindMapper.
4+
5+
## Overview
6+
7+
When scanning external dependencies with the `--include-external` flag, you might want to skip certain folders or modules to:
8+
- Reduce scanning time
9+
- Avoid processing standard library modules (like `golang.org`)
10+
- Exclude specific vendor dependencies
11+
- Focus on relevant external dependencies only
12+
13+
## Usage
14+
15+
### CLI
16+
17+
```bash
18+
# Skip golang.org modules
19+
./gomindmapper -include-external -skip-folders "golang.org"
20+
21+
# Skip multiple patterns
22+
./gomindmapper -include-external -skip-folders "golang.org,google.golang.org,github.com/go-playground"
23+
24+
# Skip with custom path
25+
./gomindmapper -path /path/to/project -include-external -skip-folders "golang.org"
26+
```
27+
28+
### Server
29+
30+
```bash
31+
# Skip golang.org modules
32+
./server -include-external -skip-folders "golang.org"
33+
34+
# Skip multiple patterns
35+
./server -include-external -skip-folders "golang.org,google.golang.org" -addr ":8080"
36+
```
37+
38+
## How It Works
39+
40+
1. **Pattern Matching**: The skip patterns use simple string containment matching. If a module path contains any of the specified patterns, it will be skipped.
41+
42+
2. **Filtering Order**:
43+
- First, all modules are read from `go.mod`
44+
- Then, modules matching skip patterns are filtered out
45+
- Finally, only relevant modules (those actually called in your code) are scanned
46+
47+
3. **Example**: If your `go.mod` contains:
48+
```
49+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
50+
google.golang.org/grpc v1.40.0
51+
github.com/gin-gonic/gin v1.7.4
52+
```
53+
54+
Using `-skip-folders "golang.org"` will skip the first two modules and only scan `github.com/gin-gonic/gin`.
55+
56+
## Common Skip Patterns
57+
58+
- `golang.org` - Skip all standard library extended packages
59+
- `google.golang.org` - Skip Google Go packages
60+
- `github.com/golang` - Skip official Go team repositories
61+
- `gopkg.in` - Skip gopkg.in packages
62+
- Specific vendors like `github.com/aws`, `github.com/docker`, etc.
63+
64+
## Benefits
65+
66+
1. **Performance**: Significantly reduces scanning time by skipping large standard library modules
67+
2. **Focus**: Helps focus on application-specific external dependencies
68+
3. **Memory**: Reduces memory usage by not loading unnecessary external functions
69+
4. **Clarity**: Produces cleaner function maps with relevant external dependencies only
70+
71+
## Example Output
72+
73+
```bash
74+
$ ./gomindmapper -include-external -skip-folders "golang.org"
75+
Scanning external modules...
76+
Skipping external dependency folders matching: [golang.org]
77+
Found 32 modules in go.mod
78+
After filtering skip patterns, scanning 23 modules
79+
Scanning module: github.com/gin-gonic/gin@v1.11.0
80+
Found 386 functions in module github.com/gin-gonic/gin
81+
...
82+
Successfully scanned external modules and found 3520 external functions
83+
```
84+
85+
This shows that 9 modules (32 - 23 = 9) were skipped due to containing "golang.org" in their path.

cmd.exe

3.79 MB
Binary file not shown.

0 commit comments

Comments
 (0)