v3.0.0
·
20 commits
to v3
since this release
[3.0.0] - 2022-11-30
This major version release of go-sdk-common corresponds to the upcoming v6.0.0 release of the LaunchDarkly Go SDK (go-server-sdk), and cannot be used with earlier SDK versions.
Added:
- The new package
ldcontextwith the typesContextandKinddefines the new "context" model. "Contexts" are a replacement for the earlier concept of "users"; they can be populated with attributes in more or less the same way as before, but they also support new behaviors. More information about these features will be included in the release notes for the v6.0.0 SDK release. - The new package
ldattrdefines the attribute reference syntax, for referencing subproperties of JSON objects in flag evaluations or private attribute configuration. Applications normally will not need to reference this package.
Changed:
- The minimum Go version is now 1.18.
- The SDK packages now use regular Go module import paths rather than
gopkg.inpaths:gopkg.in/launchdarkly/go-sdk-common.v2is replaced bygithub.com/launchdarkly/go-sdk-common/v3. - The type
lduser.Userhas been redefined to be an alias forldcontext.Context. This means that existing application code referencinglduser.Usercan still work as long as it is treating the user as an opaque value, and not calling methods on it that were specific to that type. lduser.NewUserandlduser.UserBuildernow create an instance ofContextinstead ofUser. This is as a convenience so that any code that was previously using these methods to construct a user, but did not reference theUsertype directly for the result, may still be usable without changes. It is still preferable to use the new constructors and builders forContext.- The
Secondaryattribute which existed inUserdoes not exist inContextand is no longer a supported feature. - It was previously allowable to set a user key to an empty string. In the new context model, the key is not allowed to be empty. Trying to use an empty key will cause evaluations to fail and return the default value.
- If you were using JSON serialization to produce a representation of a
User, the new typeContextuses a different JSON schema, so any code that reads the JSON will need to be adjusted. If you are passing the JSON to other code that uses LaunchDarkly SDKs, make sure you have updated all SDKs to versions that use the new context model. (However, unmarshaling aContextfrom JSON data will still work correctly even if the JSON is in the old user format.)
Removed:
- Removed the
Secondarymeta-attribute inlduser.UserBuilder.