-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change config.Retrieved to be an interface #5305
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5305 +/- ##
==========================================
- Coverage 90.75% 90.56% -0.19%
==========================================
Files 190 190
Lines 11422 11442 +20
==========================================
- Hits 10366 10363 -3
- Misses 837 858 +21
- Partials 219 221 +2
Continue to review full report at Codecov.
|
…e values that are not *Map Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
// * cfgMap the Map that will be merged to the given map in the MergeTo. | ||
// * CloseFunc specifies a function to be invoked when the configuration for which it was | ||
// used to retrieve values is no longer in use and should close and release any watchers | ||
// that it may have created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs are out of date here and above
func (r *valueRetrieved) AsMap() (*Map, error) { | ||
val, ok := r.value.(map[string]interface{}) | ||
if !ok { | ||
return nil, fmt.Errorf("retrieved value (type=%v) cannot be used as a *Map", reflect.TypeOf(r.value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use %T
in a format string to get the type
return nil, fmt.Errorf("retrieved value (type=%v) cannot be used as a *Map", reflect.TypeOf(r.value)) | |
return nil, fmt.Errorf("retrieved value (type=%T) cannot be used as a *Map", r.value) |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This is outdated at this point. |
This change will allow to implement support for "retrieving" any type of values, since we can offer implementations of the retrieved for string/etc.
Signed-off-by: Bogdan Drutu bogdandrutu@gmail.com