Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Commit

Permalink
prepare 4.7.2 release (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Apr 26, 2019
1 parent 50ee779 commit 505fe28
Show file tree
Hide file tree
Showing 5,161 changed files with 142 additions and 2,353,179 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Contributing to the LaunchDarkly SDK for Go
================================================

We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.
We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.

Note that in order to run unit tests for the `redis`, `ldconsul`, and `lddynamodb` packages, you will need to have a local instance of the corresponding database running on its default port.
3 changes: 1 addition & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# name = "github.com/x/y"
# version = "2.4.0"

[prune]
unused-packages = true
non-go = true
go-tests = true

[[constraint]]
name = "github.com/blang/semver"
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,15 @@ Database integrations

Feature flag data can be kept in a persistent store using Redis, Consul, or DynamoDB. These adapters are implemented in the subpackages `redis`, `ldconsul`, and `lddynamodb`; to use them, call the `New...FeatureStore` function provided by the subpackage, and put the returned object in the `FeatureStore` field of your client configuration. See the subpackages and the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store) for more information.

Using flag data from a file
---------------------------

For testing purposes, the SDK can be made to read feature flag state from a file or files instead of connecting to LaunchDarkly. See [`ldfiledata`](https://godoc.org/github.com/launchdarkly/go-client/ldfiledata) and [`ldfilewatch`](https://godoc.org/github.com/launchdarkly/go-client/ldfilewatch) for more details.

Learn more
-----------

Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/go-sdk-reference).
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/go-sdk-reference) and the [API reference](https://godoc.org/github.com/launchdarkly/go-client).

Testing
-------
Expand All @@ -106,18 +111,10 @@ About LaunchDarkly
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
* LaunchDarkly provides feature flag SDKs for
* [Java](http://docs.launchdarkly.com/docs/java-sdk-reference "Java SDK")
* [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK")
* [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK")
* [Python](http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK")
* [Go](http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK")
* [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK")
* [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK")
* [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK")
* [Python Twisted](http://docs.launchdarkly.com/docs/python-twisted "LaunchDarkly Python Twisted SDK")
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
* Explore LaunchDarkly
* [www.launchdarkly.com](http://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](http://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDKs
* [apidocs.launchdarkly.com](http://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
* [blog.launchdarkly.com](http://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
58 changes: 58 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
jobs:
- job: build
pool:
vmImage: 'vs2017-win2016'
steps:
- task: PowerShell@2
displayName: 'Move Source'
inputs:
targetType: inline
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
go version
go env GOPATH
mkdir C:\Users\VssAdministrator\go\src\gopkg.in\launchdarkly\go-client.v4
mv * C:\Users\VssAdministrator\go\src\gopkg.in\launchdarkly\go-client.v4\
- task: PowerShell@2
displayName: 'Setup Dynamo'
inputs:
targetType: inline
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
iwr -outf dynamo.zip https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip
mkdir dynamo
Expand-Archive -Path dynamo.zip -DestinationPath dynamo
cd dynamo
javaw -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar
- task: PowerShell@2
displayName: 'Setup Consul'
inputs:
targetType: inline
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
iwr -outf consul.zip https://releases.hashicorp.com/consul/1.4.2/consul_1.4.2_windows_amd64.zip
mkdir consul
Expand-Archive -Path consul.zip -DestinationPath consul
cd consul
sc.exe create "Consul" binPath="$(System.DefaultWorkingDirectory)/consul/consul.exe agent -dev"
sc.exe start "Consul"
- task: PowerShell@2
displayName: 'Setup Redis'
inputs:
targetType: inline
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
iwr -outf redis.zip https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip
mkdir redis
Expand-Archive -Path redis.zip -DestinationPath redis
cd redis
./redis-server --service-install
./redis-server --service-start
- task: PowerShell@2
displayName: 'Setup SDK and Test'
inputs:
targetType: inline
workingDirectory: C:\Users\VssAdministrator\go\src\gopkg.in\launchdarkly\go-client.v4
script: |
go get -t
go test -race
4 changes: 3 additions & 1 deletion ldclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ var DefaultConfig = Config{
BaseUri: "https://app.launchdarkly.com",
StreamUri: "https://stream.launchdarkly.com",
EventsUri: "https://events.launchdarkly.com",
Capacity: 1000,
Capacity: 10000,
FlushInterval: 5 * time.Second,
PollInterval: MinimumPollInterval,
Logger: log.New(os.Stderr, "[LaunchDarkly]", log.LstdFlags),
Expand Down Expand Up @@ -262,6 +262,7 @@ func (client *LDClient) Identify(user User) error {
}
if user.Key == nil || *user.Key == "" {
client.config.Logger.Printf("WARN: Identify called with empty/nil user key!")
return nil // Don't return an error value because we didn't in the past and it might confuse users
}
evt := NewIdentifyEvent(user)
client.eventProcessor.SendEvent(evt)
Expand All @@ -276,6 +277,7 @@ func (client *LDClient) Track(key string, user User, data interface{}) error {
}
if user.Key == nil || *user.Key == "" {
client.config.Logger.Printf("WARN: Track called with empty/nil user key!")
return nil // Don't return an error value because we didn't in the past and it might confuse users
}
evt := NewCustomEvent(key, user, data)
client.eventProcessor.SendEvent(evt)
Expand Down
61 changes: 61 additions & 0 deletions ldclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,49 @@ func TestIdentifySendsIdentifyEvent(t *testing.T) {
assert.Equal(t, user, e.User)
}

func TestIdentifyWithNilUserKeySendsNoEvent(t *testing.T) {
client := makeTestClient()
defer client.Close()

err := client.Identify(User{})
assert.NoError(t, err) // we don't return an error for this, we just log it

events := client.eventProcessor.(*testEventProcessor).events
assert.Equal(t, 0, len(events))
}

func TestIdentifyWithEmptyUserKeySendsNoEvent(t *testing.T) {
client := makeTestClient()
defer client.Close()

err := client.Identify(NewUser(""))
assert.NoError(t, err) // we don't return an error for this, we just log it

events := client.eventProcessor.(*testEventProcessor).events
assert.Equal(t, 0, len(events))
}

func TestTrackSendsCustomEvent(t *testing.T) {
client := makeTestClient()
defer client.Close()

user := NewUser("userKey")
key := "eventKey"
err := client.Track(key, user, nil)
assert.NoError(t, err)

events := client.eventProcessor.(*testEventProcessor).events
assert.Equal(t, 1, len(events))
e := events[0].(CustomEvent)
assert.Equal(t, user, e.User)
assert.Equal(t, key, e.Key)
assert.Nil(t, e.Data)
}

func TestTrackSendsCustomEventWithData(t *testing.T) {
client := makeTestClient()
defer client.Close()

user := NewUser("userKey")
key := "eventKey"
data := map[string]interface{}{"thing": "stuff"}
Expand All @@ -99,6 +138,28 @@ func TestTrackSendsCustomEvent(t *testing.T) {
assert.Equal(t, data, e.Data)
}

func TestTrackWithNilUserKeySendsNoEvent(t *testing.T) {
client := makeTestClient()
defer client.Close()

err := client.Track("eventkey", User{}, nil)
assert.NoError(t, err) // we don't return an error for this, we just log it

events := client.eventProcessor.(*testEventProcessor).events
assert.Equal(t, 0, len(events))
}

func TestTrackWithEmptyUserKeySendsNoEvent(t *testing.T) {
client := makeTestClient()
defer client.Close()

err := client.Track("eventkey", NewUser(""), nil)
assert.NoError(t, err) // we don't return an error for this, we just log it

events := client.eventProcessor.(*testEventProcessor).events
assert.Equal(t, 0, len(events))
}

func TestMakeCustomClient_WithFailedInitialization(t *testing.T) {
updateProcessor := mockUpdateProcessor{
IsInitialized: false,
Expand Down
14 changes: 0 additions & 14 deletions vendor/github.com/aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/github.com/aws/aws-sdk-go/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions vendor/github.com/aws/aws-sdk-go/.godoc_config

This file was deleted.

57 changes: 0 additions & 57 deletions vendor/github.com/aws/aws-sdk-go/.travis.yml

This file was deleted.

Loading

0 comments on commit 505fe28

Please sign in to comment.