diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-12 23:12:49 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-12 23:12:49 +0300 |
| commit | 0a342e08ebcc475524582260ab05841adf111596 (patch) | |
| tree | d07a7e55adae08dd547d8fa769ee1f2af5299b7f /internal | |
| parent | 2322e3651af6746f4dc03f6602b737cf6d0bd421 (diff) | |
rename ShouldIAttachTracepoint receiver from flags to f
The receiver name flags shadowed the package name flags, making the
package inaccessible inside the method body. Rename to f to match all
other receivers in flags.go and add a doc comment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/flags/flags.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 84f39e5..1844cfe 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -306,16 +306,20 @@ func (cfg Config) TraceFilter() globalfilter.Filter { return filter } -func (flags Config) ShouldIAttachTracepoint(tracepointName string) bool { - for _, re := range flags.TracepointsToExclude { +// ShouldIAttachTracepoint reports whether the given tracepoint name passes the +// attach/exclude regex filters. Exclusions are checked first; if the name +// matches any exclude pattern it is rejected regardless of the attach list. +// When the attach list is empty, all non-excluded tracepoints are accepted. +func (f Config) ShouldIAttachTracepoint(tracepointName string) bool { + for _, re := range f.TracepointsToExclude { if re.MatchString(tracepointName) { return false } } - if len(flags.TracepointsToAttach) == 0 { + if len(f.TracepointsToAttach) == 0 { return true } - for _, re := range flags.TracepointsToAttach { + for _, re := range f.TracepointsToAttach { if re.MatchString(tracepointName) { return true } |
