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 (
33
33
)
34
34
35
35
// Option is an option to change some aspect of default CDI behavior.
36
- type Option func (* Cache ) error
36
+ type Option func (* Cache )
37
37
38
38
// Cache stores CDI Specs loaded from Spec directories.
39
39
type Cache struct {
@@ -54,9 +54,8 @@ type Cache struct {
54
54
// is detected. This option can be used to disable this behavior when a
55
55
// manually refreshed mode is preferable.
56
56
func WithAutoRefresh (autoRefresh bool ) Option {
57
- return func (c * Cache ) error {
57
+ return func (c * Cache ) {
58
58
c .autoRefresh = autoRefresh
59
- return nil
60
59
}
61
60
}
62
61
@@ -92,12 +91,8 @@ func (c *Cache) Configure(options ...Option) error {
92
91
// Configure the Cache. Start/stop CDI Spec directory watch, refresh
93
92
// the Cache if necessary.
94
93
func (c * Cache ) configure (options ... Option ) error {
95
- var err error
96
-
97
94
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 )
101
96
}
102
97
103
98
c .dirErrors = make (map [string ]error )
Original file line number Diff line number Diff line change @@ -44,13 +44,12 @@ var (
44
44
45
45
// WithSpecDirs returns an option to override the CDI Spec directories.
46
46
func WithSpecDirs (dirs ... string ) Option {
47
- return func (c * Cache ) error {
47
+ return func (c * Cache ) {
48
48
specDirs := make ([]string , len (dirs ))
49
49
for i , dir := range dirs {
50
50
specDirs [i ] = filepath .Clean (dir )
51
51
}
52
52
c .specDirs = specDirs
53
- return nil
54
53
}
55
54
}
56
55
You can’t perform that action at this time.
0 commit comments