File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import (
3333)
3434
3535// Option is an option to change some aspect of default CDI behavior.
36- type Option func (* Cache ) error
36+ type Option func (* Cache )
3737
3838// Cache stores CDI Specs loaded from Spec directories.
3939type Cache struct {
@@ -54,9 +54,8 @@ type Cache struct {
5454// is detected. This option can be used to disable this behavior when a
5555// manually refreshed mode is preferable.
5656func WithAutoRefresh (autoRefresh bool ) Option {
57- return func (c * Cache ) error {
57+ return func (c * Cache ) {
5858 c .autoRefresh = autoRefresh
59- return nil
6059 }
6160}
6261
@@ -92,12 +91,8 @@ func (c *Cache) Configure(options ...Option) error {
9291// Configure the Cache. Start/stop CDI Spec directory watch, refresh
9392// the Cache if necessary.
9493func (c * Cache ) configure (options ... Option ) error {
95- var err error
96-
9794 for _ , o := range options {
98- if err = o (c ); err != nil {
99- return fmt .Errorf ("failed to apply cache options: %w" , err )
100- }
95+ o (c )
10196 }
10297
10398 c .dirErrors = make (map [string ]error )
Original file line number Diff line number Diff line change @@ -44,13 +44,12 @@ var (
4444
4545// WithSpecDirs returns an option to override the CDI Spec directories.
4646func WithSpecDirs (dirs ... string ) Option {
47- return func (c * Cache ) error {
47+ return func (c * Cache ) {
4848 specDirs := make ([]string , len (dirs ))
4949 for i , dir := range dirs {
5050 specDirs [i ] = filepath .Clean (dir )
5151 }
5252 c .specDirs = specDirs
53- return nil
5453 }
5554}
5655
You can’t perform that action at this time.
0 commit comments