feat(injector): add package-filter join point with glob patterns and module filtering#675
Conversation
9fa684d to
82c2037
Compare
36d164c to
2b1296f
Compare
…module filtering Add new "package-filter" join point that supports: - Glob pattern matching with all patterns supported by https://pkg.go.dev/path/filepath#Match - Special "*" pattern for universal matching - Module filtering with "root" for current module only - Specific module targeting (e.g., "github.com/myorg/mymodule") - Relative path matching within modules for precise filtering Signed-off-by: Kemal Akkoyun <[email protected]>
- Simplify packageFilter to use boolean root flag instead of separate module field - Update tests and test data to use new boolean parameter - Add test case for question mark not matching across path separators - Replace shell-based module detection with golang.org/x/tools/go/packages API - Consolidate documentation in public PackageFilter function
Signed-off-by: Kemal Akkoyun <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
e37b244 to
8a8d393
Compare
| - join-point: | ||
| all-of: | ||
| - package-filter: | ||
| root: true |
There was a problem hiding this comment.
I'm a little uncertain about what the intention of this primitive is -- like what is the concrete use-case this seeks to address? If that's touching on the main package -- there is already a join point that does this (package: main).
I don't know that Go has a concept of a "root" module, it has a concept of a "module root path", but this is not the same thing...
There was a problem hiding this comment.
I'm a little uncertain about what the intention of this primitive is -- like what is the concrete use-case this seeks to address? If that's touching on the main package -- there is already a join point that does this (package: main).
It's not just the main package. We try to aim the user code and exclude any 3rd party dependencies or standard library.
I don't know that Go has a concept of a "root" module, it has a concept of a "module root path", but this is not the same thing...
I'd be happy to accept better wording if you have any suggestions to define above use case.
3fdf146 to
9ba33b0
Compare
Signed-off-by: Kemal Akkoyun <[email protected]>
9ba33b0 to
999e94f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #675 +/- ##
==========================================
- Coverage 65.72% 65.70% -0.02%
==========================================
Files 113 114 +1
Lines 7926 8245 +319
==========================================
+ Hits 5209 5417 +208
- Misses 2192 2293 +101
- Partials 525 535 +10
🚀 New features to boost your workflow:
|
Add new "package-filter" join point that supports:
**) support for recursive matching across path segmentsGlobstar Examples:
github.com/myorg/**- matches any package under myorg at any depth**/internal/*- matches internal packages anywhere in dependency treegithub.com/myorg/**/api/**- complex nested pattern matchingSigned-off-by: Kemal Akkoyun [email protected]