open-feature / go-sdk

Go SDK for OpenFeature
https://openfeature.dev
Apache License 2.0
126 stars 30 forks source link

[BUG] When calling client.ObjectValueDetails with a value as nil the ResolutionDetail are not accessible. #117

Closed thomaspoignant closed 1 year ago

thomaspoignant commented 1 year ago

Observed behavior

I am using nil as a default value while calling client.ObjectValueDetails but when doing this everytime if the default value is used we receive no ResolutionDetail from the SDK.

After looking a bit at the SDK it seems that we add the ResolutionDetail only if the value is not nil. https://github.com/open-feature/go-sdk/blob/fd678bd263eb532942c4777f4eed8e26a6e52694/pkg/openfeature/client.go#L642

It means that we cannot use nil as value in the SDK.

Expected Behavior

I would like to be able to use nil as value for my flag.

Steps to reproduce

SDK return a flag with a nil value.

toddbaert commented 1 year ago

I think this is a valid use case, in other SDKs null (or Value constructs representing null) are supported.