4.16.0
[4.16.0] - 2020-02-04
This release introduces new types for building user properties and representing arbitrary JSON values. In the next major version, these will entirely replace the current deprecated equivalents.
Added:
NewUserBuilder, and its associated interfacesUserBuilderandUserBuilderCanMakeAttributePrivate. This is the new preferred mechanism for creatingUserinstances when you need to set multiple properties; it reduces unsafe and inconvenient use of pointers.Userproperty getter methods such asGetName().- The SDK has a new dependency on
gopkg.in/launchdarkly/go-sdk-common.v1, which provides the helper typesldvalue.Valueandldvalue.OptionalString. - In
LDClient,JSONVariationandJSONVariationDetailare the new preferred mechanism for evaluating flags whose values can be of any JSON type. The value is represented as anldvalue.Valuerather than ajson.RawMessage, but can be easily converted tojson.RawMessageor to other Go types. - In
LDClient,TrackDataandTrackMetricare the new preferred versions ofTrackandTrackWithMetric; they useldvalue.Valuerather thaninterface{}for the data parameter. EvaluationReasonmethodsGetRuleIndex(),GetRuleID(),GetPrerequisiteKey(),GetErrorKind(). These were formerly only on concrete implementation types such asEvaluationReasonRuleMatch; they are being added to the interface type because in a future version, it will be changed to a struct.
Fixed:
- By default, the SDK should log to
os.Stderrwith a minimum level ofldlog.Info, omitting onlyDebug-level messages. A bug introduced in 4.12.0 caused the default logger not to produce any output. It will now log atInfolevel by default again, as documented.
Deprecated:
- All exported fields of
User. In a future version, these will be hidden. Use getters such asGetName()to read these fields, andNewUserBuilderto set them. - In
LDClient,JsonVariation,JsonVariationDetail,Track, andTrackWithMetric. UseJSONVariation,JSONVariationDetail,TrackData,TrackEvent, orTrackMetricinstead. - The
EvaluationReasonimplementation types such asEvaluationReasonRuleMatchare deprecated. Instead of casting to these types, useEvaluationReasonmethods such asGetKind()andGetErrorKind().