Skip to content

Commit

Permalink
prepare 5.0.0 release (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyCI authored Sep 19, 2020
1 parent 2789f89 commit 4cec526
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 38 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

[![Circle CI](https://circleci.com/gh/launchdarkly/go-server-sdk.svg?style=shield)](https://circleci.com/gh/launchdarkly/go-server-sdk) [![Documentation](https://img.shields.io/static/v1?label=go.dev&message=reference&color=00add8)](https://pkg.go.dev/gopkg.in/launchdarkly/go-server-sdk.v5)

## This is a prerelease branch

The `v5` branch currently contains prerelease code for development of Go SDK 5.0.0. For the source code of the latest release of Go SDK 4.x, see the [`v4` branch](https://github.com/launchdarkly/go-server-sdk/tree/v4).

## LaunchDarkly overview

[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/fsnotify/fsnotify v1.4.7
github.com/gregjones/httpcache v0.0.0-20171119193500-2bcd89a1743f
github.com/launchdarkly-labs/go-coverage-enforcer v1.1.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/launchdarkly/eventsource v1.4.3
github.com/launchdarkly/go-ntlm-proxy-auth v1.0.1
github.com/launchdarkly/go-test-helpers/v2 v2.2.0
Expand All @@ -15,8 +15,8 @@ require (
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
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0-beta.5
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0-beta.3
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0-beta.5
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0
gopkg.in/yaml.v2 v2.3.0 // indirect
)
26 changes: 16 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gregjones/httpcache v0.0.0-20171119193500-2bcd89a1743f h1:kOkUP6rcVVqC+KlKKENKtgfFfJyDySYhqL9srXooghY=
github.com/gregjones/httpcache v0.0.0-20171119193500-2bcd89a1743f/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
Expand All @@ -15,13 +18,16 @@ github.com/launchdarkly/go-ntlm-proxy-auth v1.0.1 h1:Iz5cg9mB/0vt5llZE+J0iGQ5+O/
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-semver v1.0.0 h1:GbQX6vE/LiiReLmKNXxMWEK5FqgpCiTlWeCbBlou1Gs=
github.com/launchdarkly/go-semver v1.0.0/go.mod h1:BuLtReaNBN28HyoXhFZqMs4tku6igmnXH8YYMi65gVk=
github.com/launchdarkly/go-semver v1.0.1 h1:Wc6ncGCq1RGDsJhedDLlzMNWQooCc5I4FwLoDiQKcvU=
github.com/launchdarkly/go-semver v1.0.1/go.mod h1:xFmMwXba5Mb+3h72Z+VeSs9ahCvKo2QFUTHRNHVqR28=
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/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand All @@ -45,12 +51,12 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ghodss/yaml.v1 v1.0.0 h1:JlY4R6oVz+ZSvcDhVfNQ/k/8Xo6yb2s1PBhslPZPX4c=
gopkg.in/ghodss/yaml.v1 v1.0.0/go.mod h1:HDvRMPQLqycKPs9nWLuzZWxsxRzISLCRORiDpBUOMqg=
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0-beta.5 h1:FrFZw+Z24NGyQPRwnC5IlPGmHrXOITEaILk4nqN4/Og=
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0-beta.5/go.mod h1:4l1+/AtknK5Sx6YTO9XDqrCbAXj8FgwpI2U/x6ZBIM4=
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0-beta.3 h1:aQh9meEkVh6CDKhd6yMAUZNgSNRAqjHk6pnRm7V7mYE=
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0-beta.3/go.mod h1:NB1o7uZF0W2jyopumgrSC35dN7A3lKH+bN8Po0HyeNw=
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0-beta.4 h1:besGTNlSr8Ps7JEekhNrkvA8OZLlcy4CuX0sruCFX3s=
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0-beta.4/go.mod h1:usnaQ/TE1fhH6m5Xp9y/EssvcMQHIXvJonUH4spPdf0=
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0 h1:cmzeGvm90d3RSxgNWLYVQ1jQ+aEngmkzXYatnTZJ+Qc=
gopkg.in/launchdarkly/go-sdk-common.v2 v2.0.0/go.mod h1:4l1+/AtknK5Sx6YTO9XDqrCbAXj8FgwpI2U/x6ZBIM4=
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0 h1:4RFAe4vGFeMOfSYS89bi7Qrmldm0pdgFbGyF6vVYQY4=
gopkg.in/launchdarkly/go-sdk-events.v1 v1.0.0/go.mod h1:t/86BM8V7FETICTMQ8umFoC/bM2Gvx7akU9bQRD9UaE=
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0 h1:vZyXd06EBNigqRO9uld5726Jv5h3EsZBue/DKaoAsPs=
gopkg.in/launchdarkly/go-server-sdk-evaluation.v1 v1.0.0/go.mod h1:KdRntsUUWlt6RnsgNIJbxJpvFcycu5I+LVfRlALtTK8=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
Expand Down
1 change: 0 additions & 1 deletion internal/datasource/polling_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func (pp *PollingProcessor) Start(closeWhenReady chan<- struct{}) {
for {
select {
case <-pp.quit:
pp.loggers.Info("Polling has been shut down")
return
case <-ticker.C:
if err := pp.poll(); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions internal/datasource/streaming_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ func (sp *StreamProcessor) consumeStream(stream *es.Stream, closeWhenReady chan<
// after calling stream.Close(), terminating the for loop-- so we should not actually reach
// this point. Still, in case the channel is somehow closed unexpectedly, we do want to
// terminate the loop.
sp.loggers.Info("Event stream closed")
return
}
sp.logConnectionResult(true)
Expand Down Expand Up @@ -419,7 +418,6 @@ func (sp *StreamProcessor) logConnectionResult(success bool) {
//nolint:golint,stylecheck // no doc comment for standard method
func (sp *StreamProcessor) Close() error {
sp.closeOnce.Do(func() {
sp.loggers.Info("Closing event stream")
close(sp.halt)
if sp.storeStatusCh != nil {
sp.dataSourceUpdates.GetDataStoreStatusProvider().RemoveStatusListener(sp.storeStatusCh)
Expand Down
1 change: 1 addition & 0 deletions internal/datastore/persistent_data_store_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,5 +432,6 @@ func (w *persistentDataStoreWrapper) processError(err error) {
// w.statusLock every time we do anything. So we'll just do nothing here.
return
}
w.loggers.Errorf("Data store returned error: %s", err.Error())
w.statusPoller.UpdateAvailability(false)
}
10 changes: 3 additions & 7 deletions ldclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func MakeCustomClient(sdkKey string, config Config, waitFor time.Duration) (*LDC
return client, ErrInitializationFailed
}

loggers.Info("Successfully initialized LaunchDarkly client!")
loggers.Info("Initialized LaunchDarkly client")
return client, nil
case <-timeout:
loggers.Warn("Timeout encountered waiting for LaunchDarkly client initialization")
Expand Down Expand Up @@ -326,7 +326,7 @@ func (client *LDClient) TrackData(eventName string, user lduser.User, data ldval
return nil
}
if user.GetKey() == "" {
client.loggers.Warn("Track called with empty/nil user key!")
client.loggers.Warn("Track called with empty user key!")
return nil // Don't return an error value because we didn't in the past and it might confuse users
}
client.eventProcessor.RecordCustomEvent(
Expand Down Expand Up @@ -741,10 +741,6 @@ func (client *LDClient) evaluateInternal(
// THIS IS A HIGH-TRAFFIC CODE PATH so performance tuning is important. Please see CONTRIBUTING.md for guidelines
// to keep in mind during any changes to the evaluation logic.

if user.GetKey() == "" {
client.loggers.Warnf("User key is blank when evaluating flag: %s. Flag evaluation will proceed, but the user will not be stored in LaunchDarkly.", key) //nolint:lll
}

var feature *ldmodel.FeatureFlag
var storeErr error
var ok bool
Expand Down Expand Up @@ -794,7 +790,7 @@ func (client *LDClient) evaluateInternal(

detail := client.evaluator.Evaluate(feature, user, eventsScope.prerequisiteEventRecorder)
if detail.Reason.GetKind() == ldreason.EvalReasonError && client.logEvaluationErrors {
client.loggers.Warnf("flag evaluation for %s failed with error %s, default value was returned",
client.loggers.Warnf("Flag evaluation for %s failed with error %s, default value was returned",
key, detail.Reason.GetErrorKind())
}
if detail.IsDefaultValue() {
Expand Down
11 changes: 1 addition & 10 deletions ldclient_evaluation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,6 @@ func TestEvaluatingFlagWithPrerequisiteSendsPrerequisiteEvent(t *testing.T) {
})
}

func TestEvalLogsWarningIfUserKeyIsEmpty(t *testing.T) {
withClientEvalTestParams(func(p clientEvalTestParams) {
p.setupSingleValueFlag(evalFlagKey, ldvalue.Bool(true))
_, _ = p.client.BoolVariation(evalFlagKey, lduser.NewUser(""), false)
assert.Len(t, p.mockLog.GetOutput(ldlog.Warn), 1)
assert.Contains(t, p.mockLog.GetOutput(ldlog.Warn)[0], "User key is blank")
})
}

func TestEvalErrorIfStoreReturnsError(t *testing.T) {
myError := errors.New("sorry")
store := sharedtest.NewCapturingDataStore(datastore.NewInMemoryDataStore(sharedtest.NewTestLoggers()))
Expand Down Expand Up @@ -667,7 +658,7 @@ func TestUnknownFlagErrorLogging(t *testing.T) {
func TestMalformedFlagErrorLogging(t *testing.T) {
flag := ldbuilders.NewFlagBuilder("bad-flag").On(false).OffVariation(99).Build()
testEvalErrorLogging(t, &flag, "", evalTestUser,
"flag evaluation for bad-flag failed with error MALFORMED_FLAG, default value was returned")
"Flag evaluation for bad-flag failed with error MALFORMED_FLAG, default value was returned")
}

func testEvalErrorLogging(t *testing.T, flag *ldmodel.FeatureFlag, key string, user lduser.User, expectedMessageRegex string) {
Expand Down

0 comments on commit 4cec526

Please sign in to comment.