Skip to content

Commit

Permalink
merge prerelease branch
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly committed Aug 30, 2022
1 parent db6c311 commit 2076a01
Show file tree
Hide file tree
Showing 107 changed files with 786 additions and 1,117 deletions.
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ workflows:
workflow:
jobs:
- go-test:
name: Go 1.17
docker-image: cimg/go:1.17
name: Go 1.19
docker-image: cimg/go:1.19
run-lint: true
with-coverage: true
- go-test:
name: Go 1.16
docker-image: cimg/go:1.16
name: Go 1.18
docker-image: cimg/go:1.18
- go-test-windows:
name: Windows
- benchmarks
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:

- run:
name: install go-junit-report
command: go get -u github.com/jstemmer/go-junit-report
command: go install github.com/jstemmer/go-junit-report/[email protected]

- when:
condition: <<parameters.run-lint>>
Expand Down Expand Up @@ -100,14 +100,14 @@ jobs:
steps:
- checkout
- run:
name: download Go 1.16.14
name: download Go 1.18.5
command: |
$ErrorActionPreference = "Stop"
$installerUrl = "https://go.dev/dl/go1.16.14.windows-amd64.msi"
(New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.16.14.windows-amd64.msi")
$installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi"
(New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi")
- run:
name: install Go 1.16.14
command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.16.14.windows-amd64.msi /quiet"
name: install Go 1.18.5
command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet"
- run: go version
- run:
name: build and test
Expand All @@ -117,7 +117,7 @@ jobs:
benchmarks:
docker:
- image: cimg/go:1.14
- image: cimg/go:1.19
environment:
CIRCLE_ARTIFACTS: /tmp/circle-artifacts

Expand Down
9 changes: 7 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ linters:
- depguard
- dupl
- errcheck
- exportloopref
- goconst
- gochecknoglobals
- gochecknoinits
Expand All @@ -30,7 +31,6 @@ linters:
- prealloc
- revive
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
Expand All @@ -45,7 +45,12 @@ linters-settings:
simplify: false
goimports:
local-prefixes: gopkg.in/launchdarkly,github.com/launchdarkly

revive:
rules:
- name: exported
arguments:
- disableStutteringCheck

issues:
exclude-use-default: false
max-same-issues: 1000
Expand Down
2 changes: 1 addition & 1 deletion .ldrelease/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ branches:

jobs:
- docker:
image: golang:1.16-buster
image: golang:1.18-buster
template:
name: go

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to the LaunchDarkly Go SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [5.10.0] - 2022-07-05
### Added:
- `ldtestdata.FlagBuilder.VariationForAll` and `VariationForAllIndex`: new names for the deprecated methods listed below.

### Changed:
- It was possible to cause analytics event data to be lost by passing `ldvalue.Raw(nil)` or `ldvalue.Raw(json.RawMessage(""))` as a default value parameter to `JSONVariation`, or as the value of a custom user attribute, because a zero-length byte array is not a valid JSON value and would cause the event output to be malformed. The SDK now guards against this by encoding such a value as `null` in the event data. It is still possible to cause a similar problem by passing a malformed raw value as as `ldvalue.Raw(json.RawMessage("{{{"))`; it is the caller's responsibility not to do so, as the purpose of `json.RawMessage` is to avoid unnecessary parsing and implies that the value is known to be syntactically valid.

### Fixed:
- If a field in `Config.ApplicationInfo` is set to a string longer than 64 characters, the SDK will now log a warning and discard it, since the LaunchDarkly services cannot process such strings for these fields.
- Prevented a potential data race in `LDClient.Initialized()`. ([#69](https://github.com/launchdarkly/go-server-sdk/issues/69))

### Deprecated:
- `ldtestdata.FlagBuilder.VariationForAllUsers` and `VariationForAllUsersIndex`. These methods are being renamed because in the future, there will be other possible kinds of evaluation inputs that are not users, and these test methods will apply equally to those.

## [5.9.0] - 2022-03-22
### Added:
- `Config.ApplicationInfo`, for configuration of application metadata that may be used in LaunchDarkly analytics or other product features. This does not affect feature flag evaluations.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

GOLANGCI_LINT_VERSION=v1.42.1
GOLANGCI_LINT_VERSION=v1.48.0

LINTER=./bin/golangci-lint
LINTER_VERSION_FILE=./bin/.golangci-lint-version-$(GOLANGCI_LINT_VERSION)
Expand Down Expand Up @@ -30,7 +30,7 @@ clean:

test:
go test -run=not-a-real-test ./... # just ensures that the tests compile
go test -race ./...
go test -v -race ./...
@# The proxy tests must be run separately because Go caches the global proxy environment variables. We use
@# build tags to isolate these tests from the main test run so that if you do "go test ./..." you won't
@# get unexpected errors.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Supported Go versions

This version of the LaunchDarkly SDK has been tested with Go 1.16 and higher.
This version of the LaunchDarkly SDK requires a Go version of 1.18 or higher.

## Getting started

Expand Down
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
// package (https://pkg.go.dev/github.com/launchdarkly/go-server-sdk/v6/ldcomponents). For instance, to set
// the Events field to a configuration in which the SDK will flush analytics events every 10 seconds:
//
// var config ld.Config
// config.Events = ldcomponents.Events().FlushInterval(time.Second * 10)
// var config ld.Config
// config.Events = ldcomponents.Events().FlushInterval(time.Second * 10)
//
// The interfaces are defined separately from the built-in component implementations because you could also
// define your own implementation, for custom SDK integrations.
Expand Down
31 changes: 22 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
module github.com/launchdarkly/go-server-sdk/v6

go 1.16
go 1.18

require (
github.com/fsnotify/fsnotify v1.4.7
github.com/gregjones/httpcache v0.0.0-20171119193500-2bcd89a1743f
github.com/kr/pretty v0.2.1 // indirect
github.com/launchdarkly/ccache v1.1.0
github.com/launchdarkly/eventsource v1.6.2
github.com/launchdarkly/go-jsonstream/v2 v2.0.0
github.com/launchdarkly/go-jsonstream/v3 v3.0.0
github.com/launchdarkly/go-ntlm-proxy-auth v1.0.1
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.11
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.6
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.6
github.com/launchdarkly/go-test-helpers/v2 v2.3.1
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.13
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.7
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.7
github.com/launchdarkly/go-test-helpers/v3 v3.0.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/stretchr/testify v1.6.1
golang.org/x/exp v0.0.0-20220823124025-807a23277127
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/ghodss/yaml.v1 v1.0.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/launchdarkly/go-ntlmssp v1.0.1 // indirect
github.com/launchdarkly/go-semver v1.0.2 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
27 changes: 15 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@ github.com/launchdarkly/ccache v1.1.0 h1:voD1M+ZJXR3MREOKtBwgTF9hYHl1jg+vFKS/+VA
github.com/launchdarkly/ccache v1.1.0/go.mod h1:TlxzrlnzvYeXiLHmesMuvoZetu4Z97cV1SsdqqBJi1Q=
github.com/launchdarkly/eventsource v1.6.2 h1:5SbcIqzUomn+/zmJDrkb4LYw7ryoKFzH/0TbR0/3Bdg=
github.com/launchdarkly/eventsource v1.6.2/go.mod h1:LHxSeb4OnqznNZxCSXbFghxS/CjIQfzHovNoAqbO/Wk=
github.com/launchdarkly/go-jsonstream/v2 v2.0.0 h1:5NBbJmQAiUVVfAGR6tPuMITGO2+8mxLD0Azyeqgq5Yw=
github.com/launchdarkly/go-jsonstream/v2 v2.0.0/go.mod h1:8WhgeCtJdsc7VXg7tSzQmCYnw+nRAo5ReOLhVYcLiJk=
github.com/launchdarkly/go-jsonstream/v3 v3.0.0 h1:qJF/WI09EUJ7kSpmP5d1Rhc81NQdYUhP17McKfUq17E=
github.com/launchdarkly/go-jsonstream/v3 v3.0.0/go.mod h1:/1Gyml6fnD309JOvunOSfyysWbZ/ZzcA120gF/cQtC4=
github.com/launchdarkly/go-ntlm-proxy-auth v1.0.1 h1:Iz5cg9mB/0vt5llZE+J0iGQ5+O/U8CWuRUUR7Ou8eNM=
github.com/launchdarkly/go-ntlm-proxy-auth v1.0.1/go.mod h1:hKWfH/hga5oslM2mRkDZi+14u2h1dFsmgbvSM9qF8pk=
github.com/launchdarkly/go-ntlmssp v1.0.1 h1:snB77118TQvf9tfHrkSyrIop/UX5e5VD2D2mv7Kh3wE=
github.com/launchdarkly/go-ntlmssp v1.0.1/go.mod h1:/cq3t2JyALD7GdVF5BEWcEuGlIGa44FZ4v4CVk7vuCY=
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.11 h1:rAtM8+6ev8q1UJD8wP4neQnecbHJOU05v9yH1SNLwy8=
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.11/go.mod h1:YnR3wgQ71r/ORkZeMG2OPAZFrb9Xcd5rH3QKiK3Z45A=
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.6 h1:PBH8R5sulwljaKJAgHyBtml43lTwWI1a5px7YaMbo+0=
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.6/go.mod h1:E7tqjYG7YJz/j515tk7S/wifgHrPgN4fSF7fD4k9eYo=
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.13 h1:5HCvSLKBDdpR34DuH8VZ4sefRY3DMdD4TI+RSLxDfHo=
github.com/launchdarkly/go-sdk-common/v3 v3.0.0-alpha.pub.13/go.mod h1:z1m35n8ygOe6Ti8uraKoixpP54twJi7Cgi7AjUQmXqU=
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.7 h1:srUe2a7TuKYI1Qjj6k0N40D5AFyp3eUFdCb6ZbqIjtI=
github.com/launchdarkly/go-sdk-events/v2 v2.0.0-alpha.pub.7/go.mod h1:RSOSR+TNoeTu+CtKA6MUcaGvX7ZEGnmCHVDye5HbANM=
github.com/launchdarkly/go-semver v1.0.2 h1:sYVRnuKyvxlmQCnCUyDkAhtmzSFRoX6rG2Xa21Mhg+w=
github.com/launchdarkly/go-semver v1.0.2/go.mod h1:xFmMwXba5Mb+3h72Z+VeSs9ahCvKo2QFUTHRNHVqR28=
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.6 h1:m8uLyCNyfnSTquJEhBIjGJMlkkg3kzruXyMMosSc4qo=
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.6/go.mod h1:9BEot3iVWTV3Jvd73GFGGlMbS1dP4n8GVAMOMuUZQDs=
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.7 h1:doly8UuP/jhR/p+nHDE8y8nL9KXA8Hc9DQzLHafDP8Q=
github.com/launchdarkly/go-server-sdk-evaluation/v2 v2.0.0-alpha.pub.7/go.mod h1:LjAlqYDYQFpic/0jkDfBfUyErZJZS7a8sQuSV/OBCX4=
github.com/launchdarkly/go-test-helpers/v2 v2.2.0 h1:L3kGILP/6ewikhzhdNkHy1b5y4zs50LueWenVF0sBbs=
github.com/launchdarkly/go-test-helpers/v2 v2.2.0/go.mod h1:L7+th5govYp5oKU9iN7To5PgznBuIjBPn+ejqKR0avw=
github.com/launchdarkly/go-test-helpers/v2 v2.3.1 h1:KXUAQVTeHNcWVDVQ94uEkybI+URXI9rEd7E553EsZFw=
github.com/launchdarkly/go-test-helpers/v2 v2.3.1/go.mod h1:L7+th5govYp5oKU9iN7To5PgznBuIjBPn+ejqKR0avw=
github.com/launchdarkly/go-test-helpers/v3 v3.0.2 h1:rh0085g1rVJM5qIukdaQ8z1XTWZztbJ49vRZuveqiuU=
github.com/launchdarkly/go-test-helpers/v3 v3.0.2/go.mod h1:u2ZvJlc/DDJTFrshWW50tWMZHLVYXofuSHUfTU/eIwM=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
Expand All @@ -53,13 +54,15 @@ github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdms
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20220823124025-807a23277127 h1:S4NrSKDfihhl3+4jSTgwoIevKxX9p7Iv9x++OEIptDo=
golang.org/x/exp v0.0.0-20220823124025-807a23277127/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
Expand Down
14 changes: 7 additions & 7 deletions interfaces/big_segment_store_status_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ package interfaces
// Available property is true, then the SDK is able to evaluate context membership in Big Segments,
// the Stale property indicates whether the data might be out of date.
//
// status := client.GetBigSegmentStoreStatusProvider().GetStatus()
// status := client.GetBigSegmentStoreStatusProvider().GetStatus()
//
// Second, you can use AddStatusListener to get a channel that provides a status update whenever the
// Big Segment store has an error or starts working again.
//
// statusCh := client.GetBigSegmentStoreStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("Big Segment store status is now: %+v", newStatus)
// }
// }()
// statusCh := client.GetBigSegmentStoreStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("Big Segment store status is now: %+v", newStatus)
// }
// }()
type BigSegmentStoreStatusProvider interface {
// GetStatus returns the current status of the store.
GetStatus() BigSegmentStoreStatus
Expand Down
28 changes: 14 additions & 14 deletions interfaces/data_source_status_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ import (
// There are three ways to interact with the data source status. One is to simply get the current status;
// if its State property is DataSourceStateValid, then the SDK is able to receive feature flag updates.
//
// status := client.GetDataSourceStatusProvider().GetStatus()
// isValid = status.State == interfaces.DataSourceStateValid
// status := client.GetDataSourceStatusProvider().GetStatus()
// isValid = status.State == interfaces.DataSourceStateValid
//
// Second, you can use AddStatusListener to get a channel that provides a status update whenever the
// connection has an error or starts working again.
//
// statusCh := client.GetDataSourceStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("data source status is now: %+v", newStatus)
// }
// }()
// statusCh := client.GetDataSourceStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("data source status is now: %+v", newStatus)
// }
// }()
//
// Third, you can use WaitFor to block until the data source has the desired status. For instance, if you
// did not want to wait for a connection when you originally created the client, you could set the
// timeout to zero so that the connection happens in the background. Then, when you need to do something
// that requires a valid connection (possibly on another goroutine), you can wait until it is valid.
//
// client, _ := ld.MakeCustomClient(sdkKey, config, 0)
// client, _ := ld.MakeCustomClient(sdkKey, config, 0)
//
// // later...
// inited := client.GetDataSourceStatusProvider().WaitFor(interfaces.DataSourceStateValid, 10 * time.Second)
// if !inited {
// // do whatever is appropriate if initialization has timed out
// }
// // later...
// inited := client.GetDataSourceStatusProvider().WaitFor(interfaces.DataSourceStateValid, 10 * time.Second)
// if !inited {
// // do whatever is appropriate if initialization has timed out
// }
type DataSourceStatusProvider interface {
// GetStatus returns the current status of the data source.
//
Expand Down
16 changes: 8 additions & 8 deletions interfaces/data_store_status_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ package interfaces
// There are two ways to interact with the data store status. One is to simply get the current status; if
// its Available property is true, then the store is working normally.
//
// status := client.GetDataStoreStatusProvider().GetStatus()
// isValid = status.Available
// status := client.GetDataStoreStatusProvider().GetStatus()
// isValid = status.Available
//
// Second, you can use AddStatusListener to get a channel that provides a status update whenever the
// data store has an error or starts working again.
//
// statusCh := client.GetDataStoreStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("data store Available is %t", newStatus.Available)
// }
// }()
// statusCh := client.GetDataStoreStatusProvider().AddStatusListener()
// go func() {
// for newStatus := range statusCh {
// log.Printf("data store Available is %t", newStatus.Available)
// }
// }()
type DataStoreStatusProvider interface {
// GetStatus returns the current status of the store.
//
Expand Down
11 changes: 4 additions & 7 deletions interfaces/flagstate/flags_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package flagstate
import (
"fmt"

"github.com/launchdarkly/go-jsonstream/v2/jwriter"
"github.com/launchdarkly/go-jsonstream/v3/jwriter"
"github.com/launchdarkly/go-sdk-common/v3/ldreason"
"github.com/launchdarkly/go-sdk-common/v3/ldtime"
"github.com/launchdarkly/go-sdk-common/v3/ldvalue"

"golang.org/x/exp/maps"
)

// AllFlags is a snapshot of the state of multiple feature flags with regard to a specific evaluation
Expand Down Expand Up @@ -178,12 +180,7 @@ func NewAllFlagsBuilder(options ...Option) *AllFlagsBuilder {

// Build returns an immutable State instance copied from the current builder data.
func (b *AllFlagsBuilder) Build() AllFlags {
s := b.state
s.flags = make(map[string]FlagState, len(b.state.flags))
for k, v := range b.state.flags {
s.flags[k] = v
}
return s
return AllFlags{valid: b.state.valid, flags: maps.Clone(b.state.flags)}
}

// AddFlag adds information about a flag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
// GetStatus or AddStatusListener.
type bigSegmentStoreStatusProviderImpl struct {
getStatusFn func() interfaces.BigSegmentStoreStatus
broadcaster *internal.BigSegmentStoreStatusBroadcaster
broadcaster *internal.Broadcaster[interfaces.BigSegmentStoreStatus]
}

// NewBigSegmentStoreStatusProviderImpl creates the internal implementation of
// BigSegmentStoreStatusProvider. The manager parameter can be nil if there is no Big Segment store.
func NewBigSegmentStoreStatusProviderImpl(
getStatusFn func() interfaces.BigSegmentStoreStatus,
broadcaster *internal.BigSegmentStoreStatusBroadcaster,
broadcaster *internal.Broadcaster[interfaces.BigSegmentStoreStatus],
) interfaces.BigSegmentStoreStatusProvider {
return &bigSegmentStoreStatusProviderImpl{
getStatusFn: getStatusFn,
Expand Down
Loading

0 comments on commit 2076a01

Please sign in to comment.