From 0a342e08ebcc475524582260ab05841adf111596 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 12 May 2026 23:12:49 +0300 Subject: 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 --- internal/flags/flags.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'internal') 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 } -- cgit v1.2.3