File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,12 +130,25 @@ func WithInfoTimeout(d time.Duration) DiscoverOption {
130130 }
131131}
132132
133- // WithWarnFunc sets a callback for non-fatal warnings during discovery.
134- // Warnings include unreadable directories and plugin metadata timeouts.
135- // If not set, warnings are silently ignored and discovery continues.
136- // This is useful for logging partial failures without aborting discovery .
133+ // WithWarnFunc sets a callback for non-fatal errors during discovery.
134+ // When set, discovery continues past errors (unreadable directories, plugin
135+ // metadata timeouts) by calling the callback instead of failing. Without this
136+ // option, the first error causes [Discover] to return immediately .
137137//
138- // Example:
138+ // To collect all errors while still completing discovery:
139+ //
140+ // var errs []error
141+ // plugins, _ := cli.Discover(
142+ // cli.WithDirs(cli.DefaultDirs("myapp")...),
143+ // cli.WithWarnFunc(func(err error) {
144+ // errs = append(errs, err)
145+ // }),
146+ // )
147+ // if len(errs) > 0 {
148+ // // Handle accumulated errors
149+ // }
150+ //
151+ // For simple logging:
139152//
140153// cli.Discover(
141154// cli.WithDirs(cli.DefaultDirs("myapp")...),
You can’t perform that action at this time.
0 commit comments