Skip to content

Releases: launchdarkly/go-server-sdk

5.2.1

11 Feb 22:20

Choose a tag to compare

[5.2.1] - 2021-02-11

Fixed:

  • When deserializing feature flags from JSON, an explicit null value for the rollout property (as opposed to just omitting the property) was being treated as an error. The LaunchDarkly service endpoints do not ever send rollout: null, but it should be considered valid if encountered in JSON from some other source.

5.2.0

26 Jan 19:09

Choose a tag to compare

[5.2.0] - 2021-01-26

Added:

  • Added the Alias method to LDClient. This can be used to associate two user objects for analytics purposes with an alias event.

5.1.4

22 Jan 03:33

Choose a tag to compare

[5.1.4] - 2021-01-21

Fixed:

  • Starting in version 5.1.0, an Info-level log message got put: {DATA} was being logged upon making a stream connection, where {DATA} was the JSON representation of all of the feature flag data received from LaunchDarkly. This was unintentional and has been removed.

5.1.3

21 Jan 03:11

Choose a tag to compare

[5.1.3] - 2021-01-20

Fixed:

  • When using semantic version operators, semantic version strings were being rejected by the SDK if they contained a zero digit in any position after the first character of a numeric version component. For instance, 0.1.2 and 1.2.3 were accepted, and 01.2.3 was correctly rejected (leading zeroes for nonzero values are not allowed), but 10.2.3 was incorrectly rejected. This would cause the flag/segment clause to incorrectly return a "match" or "no match" result depending on how the clause was written.

5.1.2

12 Jan 02:52

Choose a tag to compare

[5.1.2] - 2021-01-11

Fixed:

  • If you provide an SDK key that contains an invalid character such as a newline, MakeClient or MakeCustomClient will fail immediately with the error message SDK key contains invalid characters. Previously, it would try to use the invalid key in an HTTP request to LaunchDarkly, and the resulting error message (produced by the Go standard library) would be net/http: invalid header field value [xxx] for key Authorization, where [xxx] was the key you had provided; that could be undesirable if for instance it was a real key that you had accidentally added a newline to, causing the actual SDK key to be visible in the error message in your application log.
  • The ldfilewatch package, for using the file data source in auto-update mode, produced some unnecessary and cryptic log messages such as waitForEvents and got close. These have been removed. Instead, the file data source now logs the message Reloading flag data after detecting a change (at Info level) if a file has been updated. (#48)

5.1.1

05 Jan 03:42

Choose a tag to compare

[5.1.1] - 2021-01-04

Fixed:

  • Parsing a User from JSON failed if there was a privateAttributeNames property whose value was null. This has been fixed so that it behaves the same as if the property had a value of [] or if it was not present at all.

5.1.0

18 Dec 03:27

Choose a tag to compare

[5.1.0] - 2020-12-17

Added:

  • The SDK now has an optional integration with the EasyJSON library to increase the efficiency of JSON encoding and decoding. This is enabled if you add the build tag launchdarkly_easyjson to your build (go build -tags launchdarkly_easyjson); no other changes are required. If you do not set the build tag, the SDK does not reference any EasyJSON code.

Changed:

  • The SDK's default JSON encoding and decoding logic has been changed to use the new LaunchDarkly library go-jsonstream instead of Go's built-in encoding/json. This should reduce spikes in CPU and memory usage that could occur when the SDK is receiving JSON data from LaunchDarkly or from a database, especially in environments with many feature flags or complex flag configurations. There is also the option to use EasyJSON as described above, but even without that, the new implementation is much more efficient than encoding/json; depending on the size of the data, it can reduce execution time and heap allocations during JSON parsing by roughly 50%.

Fixed:

  • Removed an extra newline from the "Reconnecting in..." message that is logged for stream reconnections.

5.0.2

20 Oct 22:20

Choose a tag to compare

[5.0.2] - 2020-10-20

Fixed:

  • When serializing JSON representations for deleted flags and segments, properties with default values (such as false booleans or empty arrays) were being dropped entirely to save bandwidth. However, these representations may be consumed by SDKs other than the Go SDK, and some of the LaunchDarkly SDKs do not tolerate missing properties (PHP in particular), so this has been fixed to remain consistent with the less efficient behavior of Go SDK 4.x. This is very similar to a bug that was fixed in the 5.0.1 release, but it only affects deleted items; we store a placeholder for these (a tombstone) and the JSON for this was being created in a different code path from the one that was fixed.
  • The types in go-sdk-common.v2/lduser and go-sdk-common.v2/ldvalue now provide more specific validation errors for JSON unmarshalling, as described in the go-sdk-common 2.0.1 release notes.

5.0.1

08 Oct 19:46

Choose a tag to compare

[5.0.1] - 2020-10-08

Fixed:

  • When serializing flags and segments to JSON, properties with default values (such as false booleans or empty arrays) were being dropped entirely to save bandwidth. However, these representations may be consumed by SDKs other than the Go SDK, and some of the LaunchDarkly SDKs do not tolerate missing properties, so this has been fixed to remain consistent with the less efficient behavior of Go SDK 4.x.

5.0.0

19 Sep 00:12

Choose a tag to compare

[5.0.0] - 2020-09-18

This is a major rewrite that introduces a cleaner API design, adds new features, and makes the SDK code easier to maintain and extend. See the Go 4.x to 5.0 migration guide for an in-depth look at the changes in this version; the following is a summary.

Added:

  • You can tell the SDK to notify you whenever a feature flag's configuration has changed (either in general, or in terms of its result for a specific user), using LDClient.GetFlagTracker().
  • You can monitor the status of the SDK's data source (which normally means the streaming connection to the LaunchDarkly service) with LDClient.GetDataSourceStatusProvider(). This allows you to check the current connection status, and to be notified if this status changes.
  • You can monitor the status of a persistent data store with LDClient.GetDataStoreStatusProvider(). This allows you to check whether database updates are succeeding, to be notified if this status changes, and to get caching statistics.
  • LDClient.WithEventsDisabled() is a decorator that allows you to temporarily turn off analytics events even if events are enabled in your configuration.
  • LDConfig.Logging is a new configuration category for options related to logging. See ldcomponents.Logging() and ldcomponents.NoLogging().
  • The testhelpers/ldtestdata package provides an alternative to ldfiledata for simulating feature flag data in test code.
  • The object returned by AllFlagsState() can now be constructed (such as for testing purposes) with flagstate.NewAllFlagsBuilder().
  • In interfaces, LDClientInterface, LDClientEvaluations, and LDClientEvents are new interfaces describing the existing methods of LDClient. These may be useful for creating mocks in testing.

Changed (breaking changes from 4.x):

  • The User and UserBuilder types are now in the package gopkg.in/launchdarkly/go-sdk-common.v2/lduser. Users can no longer be created as inline structs; you must use lduser.NewUser, lduser.NewAnonymousUser, or lduser.NewUserBuilder.
  • The EvaluationDetail and EvaluationReason types are now in the package gopkg.in/launchdarkly/go-sdk-common.v2/ldreason.
  • EvaluationDetail.VariationIndex now uses the type ldvalue.OptionalInt instead of the *int pointer type.
  • EvaluationReason is now a struct rather than an interface, and is just one type rather than having separate types for each Kind.
  • The ldlog.Loggers abstraction is now in the package gopkg.in/launchdarkly/go-sdk-common.v2/ldlog.
  • Configuration properties that are specific to one mode of operation are no longer represented as fields in Config, but as builder methods on a component that is provided by the new ldcomponents package and is then placed in Config. For instance, instead of setting Capacity: 1000, you would now set Events: ldcomponents.SendEvents().Capacity(1000); to disable events, instead of setting SendEvents: false, you would set Events: ldcomponents.NoEvents() (note that NoEvents does not allow you to set Capacity, since that would be meaningless if events are disabled). Similarly, to disable streaming and use polling, set DataSource: ldcomponents.PollingDataSource() which then provides optional methods for configuring polling. See Config and ldcomponents for more details.
  • The database integrations that were formerly in the redis, lddynamodb, and ldconsul subpackages have been moved to their own repositories: go-server-sdk-redis-redigo, go-server-sdk-dynamodb, and go-server-sdk-consul. This removes the transitive dependencies on Redigo, AWS, etc.— which would otherwise be loaded for all Go modules that reference the SDK, even if you do not reference the subpackages that use them— and also allows fixes or new features to be released for those integrations without requiring a new SDK release.
  • The configuration syntax for the database integrations has changed so that they now use a builder pattern, instead of a factory function with option arguments, and must be used in combination with ldcomponents.PersistentDataStore. See the new repositories for documentation and examples.
  • The ldfiledata integration now also uses a builder pattern for configuration.
  • Types related to LDClient.AllFlagsState() are now in the interfaces/flagstate package, and their names have changed as follows: FeatureFlagsState is now flagstate.AllFlags; ClientSideOnly is now flagstate.OptionClientSideOnly(); DetailsOnlyForTrackedFlags is now flagstate.OptionDetailsOnlyForTrackedFlags()`.
  • The component interfaces FeatureStore and UpdateProcessor have been renamed to DataStore and DataSource. The factory interfaces for these components now receive SDK configuration options in a different way that does not expose other components' configurations to each other.
  • The PersistentDataStore interface for creating your own database integrations has been simplified by moving all of the serialization and caching logic into the main SDK code.
  • FeatureFlag, Segment, and other data model types are now in the package gopkg.in/launchdarkly/go-server-sdk-evaluation.v1. Application code will not normally need to refer to these types.
  • All types related to the low-level handling of analytics events are now in the package gopkg.in/launchdarkly/go-sdk-events.v1. Application code will not normally need to refer to these types.

Changed (requirements/dependencies/build):

  • The lowest supported Go version is 1.14.
  • Code coverage reports and benchmarks are now generated in every build. Unit test coverage of the entire SDK codebase has been greatly improved.

Changed (behavioral changes):

  • If analytics events are disabled, the SDK now avoids generating any analytics event objects internally. Previously they were created and then discarded, causing unnecessary heap churn.
  • Network failures and server errors for streaming or polling requests were previously logged at ERROR level in most cases but sometimes at WARN level. They are now all at WARN level, but with a new behavior: if connection failures continue without a successful retry for a certain amount of time, the SDK will log a special ERROR-level message to warn you that this is not just a brief outage. The amount of time is one minute by default, but can be changed with the new LogDataSourceOutageAsErrorAfter option in LoggingConfigurationBuilder.
  • Reading a User from JSON with json.Unmarshal now returns an error if the key property is missing or null.

Changed (performance improvements):

  • Improved the performance of flag evaluations when there is a very long user target list in a feature flag or user segment, by representing the user key collection internally as a map.
  • Evaluation of rules involving regex matches, date/time values, and semantic versions, has been speeded up by pre-parsing the values in the rules. Also, parsing of date/time values and semantic versions in user attributes now uses a faster implementation and does not make any heap allocations.
  • Evaluation of rules involving an equality match to multiple values (such as "name is one of X, Y, Z") has been speeded up by converting the list of values to a map.
  • Many internal methods have been rewritten to reduce the number of heap allocations in general.

Removed:

  • DefaultConfig was removed since it is no longer necessary: an empty Config{} is valid and will provide all of the documented default behavior. If you need to access the default value for a property, use the corresponding constant, such as ldcomponents.DefaultEventsCapacity.
  • The sharedtest subpackage, which contains test helpers for the SDK itself, is now internal and cannot be used from application code. Test helpers that were meant to be public are now in the testhelpers subpackage.
  • Removed all types, fields, and methods that were deprecated as of the most recent 4.x release.