diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9e31981 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @splitio/sdk diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..075ff53 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,10 @@ +--- +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + reviewers: + - "splitio/sdk" diff --git a/.github/pull-request-template.md b/.github/pull-request-template.md new file mode 100644 index 0000000..0919e9a --- /dev/null +++ b/.github/pull-request-template.md @@ -0,0 +1,7 @@ +# Split OpenFeature Provider Pull Request Template + +## What did you accomplish? + +## How do we test the changes introduced in this PR? + +## Extra Notes diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..49d63dd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +name: ci +on: + push: + branches-ignore: + - none + pull_request: + branches: + - development + - main + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + services: + redis: + image: redis + ports: + - 6379:6379 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go version + uses: actions/setup-go@v5 + with: + go-version: '1.23.0' + + - name: Go mod + run: go mod tidy + + - name: Execute tests + run: go test -coverprofile=coverage.out -count=1 -race ./... + + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v5.2.0 + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONARQUBE_HOST }} diff --git a/.github/workflows/update-license-year.yaml b/.github/workflows/update-license-year.yaml new file mode 100644 index 0000000..f46ed9d --- /dev/null +++ b/.github/workflows/update-license-year.yaml @@ -0,0 +1,45 @@ +name: Update License Year + +on: + schedule: + - cron: "0 3 1 1 *" # 03:00 AM on January 1 + +permissions: + contents: write + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set Current year + run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" + + - name: Set Previous Year + run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" + + - name: Update LICENSE + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: ${{ env.PREVIOUS }} + replace: ${{ env.CURRENT }} + include: "LICENSE.txt" + regex: false + + - name: Commit files + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git commit -m "Updated License Year" -a + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: Update License Year + branch: update-license diff --git a/CHANGES.txt b/CHANGES.txt index d70bf22..d41ecdb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 1.0.0 - 10/3/2022. Up to date with spec v0.5.0 and go sdk v0.5.0 1.0.1 -- 10/14/2022. Up to date with spec v0.5.0 and go sdk v0.6.0 \ No newline at end of file +- 10/14/2022. Up to date with spec v0.5.0 and go sdk v0.6.0 +1.1.0 +- 6/3/2025. Up to date with OpenFeature spec v0.8.0 and go sdk v1.15.0. Harness Go Client v6.7.0 diff --git a/README.md b/README.md index 25b6945..0d708ac 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Split OpenFeature Provider for Go -[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware) +[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=harnessio) ## Overview -This Provider is designed to allow the use of OpenFeature with Split, the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience. +This Provider is designed to allow the use of OpenFeature with Split (Acquired by Harness), the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience. ## Compatibility -This SDK is compatible with Go 1.19 and higher. +This SDK is compatible with Go 1.23 and higher. ## Getting started Below is a simple example that describes the instantiation of the Split Provider. Please see the [OpenFeature Documentation](https://docs.openfeature.dev/docs/reference/concepts/evaluation-api) for details on how to use the OpenFeature SDK. @@ -85,28 +85,27 @@ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to s ## License Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/). -## About Split +## About Harness FME (Formerly Split.io) -Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery. +Harness Feature Management and Experimentation (formerly Split) is a leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay have trusted Split to power their feature delivery. -To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup. +To learn more about Harness Feature Management and Experimentation (formerly Split), visit the [Harness website](https://www.harness.io/products/feature-management-experimentation) or contact [Harness Sales](https://harness.io/contact/sales). -Split has built and maintains SDKs for: +Harness has built and maintains SDKs for: -* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) -* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) -* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) -* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK) -* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) -* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) -* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK) -* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK) -* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK) -* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK) +* Java [Github](https://github.com/splitio/java-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/java-sdk) +* Javascript [Github](https://github.com/splitio/javascript-client) [Docs]() +* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/nodejs-sdk) +* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/net-sdk) +* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/ruby-sdk) +* PHP [Github](https://github.com/splitio/php-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/php-sdk) +* Python [Github](https://github.com/splitio/python-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/python-sdk) +* GO [Github](https://github.com/splitio/go-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/server-side-sdks/go-sdk) +* Android [Github](https://github.com/splitio/android-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/android-sdk) +* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/ios-sdk) For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20). -**Learn more about Split:** - -Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information. +**Learn more about Harness:** +Visit [harness.io](https://www.harness.io) for an overview of Harness, or visit our documentation at [developer.harness.io/docs](https://developer.harness.io/docs) for more detailed information. diff --git a/go.mod b/go.mod index e5264d3..50f87d5 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,25 @@ module github.com/splitio/split-openfeature-provider-go -go 1.19 +go 1.23.0 + +toolchain go1.24.2 require ( - github.com/open-feature/go-sdk v0.6.0 - github.com/splitio/go-client v6.1.1-0.20210611192632-af2ff877b14a+incompatible - github.com/splitio/go-toolkit v4.2.1-0.20210714181516-85e7c471376a+incompatible + github.com/open-feature/go-sdk v1.15.0 + github.com/splitio/go-client/v6 v6.7.0 + github.com/splitio/go-toolkit/v5 v5.4.0 ) require ( - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-redis/redis v6.15.9+incompatible // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.20.2 // indirect - github.com/splitio/go-split-commons v3.1.1-0.20210714173613-90097f92c8af+incompatible // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + github.com/bits-and-blooms/bitset v1.22.0 // indirect + github.com/bits-and-blooms/bloom/v3 v3.7.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/redis/go-redis/v9 v9.9.0 // indirect + github.com/splitio/go-split-commons/v6 v6.1.0 // indirect + go.uber.org/mock v0.5.2 // indirect + golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect + golang.org/x/sync v0.14.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 501de24..fd5eaba 100644 --- a/go.sum +++ b/go.sum @@ -1,102 +1,47 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCkcs2uw7w4= +github.com/bits-and-blooms/bitset v1.22.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bloom/v3 v3.7.0 h1:VfknkqV4xI+PsaDIsoHueyxVDZrfvMn56jeWUzvzdls= +github.com/bits-and-blooms/bloom/v3 v3.7.0/go.mod h1:VKlUSvp0lFIYqxJjzdnSsZEw4iHb1kOL2tfHTgyJBHg= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +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/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= -github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= -github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/open-feature/go-sdk v0.4.0 h1:4MC58EBEqsZRPrBfjywTEZXlgiD7lFQVSz0XIJQIRLM= -github.com/open-feature/go-sdk v0.4.0/go.mod h1:rLTOsXIC5wJ/5iVZ0LOTz3/ahJmzxhzWcJTS81AaSqM= -github.com/open-feature/go-sdk v0.5.0 h1:1Y3TYoiZn8yhez9SS6VkS0n9WTfIDst1QDGV92WWHeE= -github.com/open-feature/go-sdk v0.5.0/go.mod h1:5yoSk6QrkAHXKQW9pD+ejxOx3uXUqJwoHmwEK4hlZvk= -github.com/open-feature/go-sdk v0.5.1 h1:gra5dYqcgz3DuyKuOA3TIXS8MuYqNCTVgJpNGemkAQ8= -github.com/open-feature/go-sdk v0.5.1/go.mod h1:5yoSk6QrkAHXKQW9pD+ejxOx3uXUqJwoHmwEK4hlZvk= -github.com/open-feature/go-sdk v0.6.0 h1:/u1XH4msHeChaen65Alfk139/ifu8ZS3mLt37CenR5k= -github.com/open-feature/go-sdk v0.6.0/go.mod h1:5yoSk6QrkAHXKQW9pD+ejxOx3uXUqJwoHmwEK4hlZvk= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/open-feature/go-sdk v1.15.0 h1:FEZl4kCH6H2drhnQ0dheDBxLvwwzO7zvzdUl8zzZLX4= +github.com/open-feature/go-sdk v1.15.0/go.mod h1:LkqPL/17XMGcRvTdk1qqwSSG1ICe/D2MQP0blDaXfh0= +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/splitio/go-client v6.1.1-0.20210611192632-af2ff877b14a+incompatible h1:ahRviKx2RNNwK2b9NQbD9Iv1DLfHn+KHoBXwmbQ1EgY= -github.com/splitio/go-client v6.1.1-0.20210611192632-af2ff877b14a+incompatible/go.mod h1:dJcPPOO+DlFMELdWAqGUcHTXGvGw0km+UEZJie7Hejk= -github.com/splitio/go-split-commons v3.1.1-0.20210714173613-90097f92c8af+incompatible h1:jaP0z3iiwOYgneBEL7MGkUZNeQgsDiWqa6EBKBgSpQc= -github.com/splitio/go-split-commons v3.1.1-0.20210714173613-90097f92c8af+incompatible/go.mod h1:w1uWXr+HcRVJLeoVyZucm+r3dt0W7zj7Sa9H2TCB3kA= -github.com/splitio/go-toolkit v4.2.1-0.20210714181516-85e7c471376a+incompatible h1:vK8jmQOWqghCU9ZYPjHfrngpugLOFsc4tUMa4OqRk8M= -github.com/splitio/go-toolkit v4.2.1-0.20210714181516-85e7c471376a+incompatible/go.mod h1:Oygm4Hgf3KotB5ZAaXIluLk5HgH2qu723HEPNvszJi8= -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/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -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-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +github.com/redis/go-redis/v9 v9.9.0 h1:URbPQ4xVQSQhZ27WMQVmZSo3uT3pL+4IdHVcYq2nVfM= +github.com/redis/go-redis/v9 v9.9.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= +github.com/splitio/go-client/v6 v6.7.0 h1:1r+rYRTXvIo8xCwwiqbcVkw9ZSGXD02aFT+1P02teiQ= +github.com/splitio/go-client/v6 v6.7.0/go.mod h1:vXT4V2MystDJd6fEmqO64t07Ws2oLmdRg0gu2eOuyIo= +github.com/splitio/go-split-commons/v6 v6.1.0 h1:k3mwr12DF6gbEaV8XXU/tSAQlPkIEuzIgTEneYhGg2I= +github.com/splitio/go-split-commons/v6 v6.1.0/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY= +github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM= +github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg= +github.com/twmb/murmur3 v1.1.6/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= +golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b h1:QoALfVG9rhQ/M7vYDScfPdWjGL9dlsVVM5VGh7aKoAA= +golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/provider.go b/provider.go index 762f17a..e68bc6b 100644 --- a/provider.go +++ b/provider.go @@ -3,11 +3,12 @@ package split_openfeature_provider_go import ( "context" "encoding/json" - "github.com/splitio/go-client/splitio/conf" "strconv" - "github.com/open-feature/go-sdk/pkg/openfeature" - "github.com/splitio/go-client/splitio/client" + "github.com/splitio/go-client/v6/splitio/conf" + + "github.com/open-feature/go-sdk/openfeature" + "github.com/splitio/go-client/v6/splitio/client" ) type SplitProvider struct { diff --git a/provider_test.go b/provider_test.go index 8667a3a..9cbee73 100644 --- a/provider_test.go +++ b/provider_test.go @@ -1,13 +1,19 @@ package split_openfeature_provider_go import ( - "github.com/open-feature/go-sdk/pkg/openfeature" - "github.com/splitio/go-client/splitio/client" - "github.com/splitio/go-client/splitio/conf" - "github.com/splitio/go-toolkit/logging" + "context" + "os" + "os/user" + "path" "reflect" "strings" "testing" + "time" + + "github.com/open-feature/go-sdk/openfeature" + "github.com/splitio/go-client/v6/splitio/client" + "github.com/splitio/go-client/v6/splitio/conf" + "github.com/splitio/go-toolkit/v5/logging" ) func create(t *testing.T) *openfeature.Client { @@ -32,7 +38,10 @@ func create(t *testing.T) *openfeature.Client { if provider == nil { t.Error("Error creating Split Provider") } - openfeature.SetProvider(provider) + err = openfeature.SetProvider(provider) + if err != nil { + t.Error(err) + } return openfeature.NewClient("test_client") } @@ -41,12 +50,45 @@ func evaluationContext() openfeature.EvaluationContext { } func TestCreateSimple(t *testing.T) { + usr, err := user.Current() + if err != nil { + t.Fatalf("Error fetching current user: %v", err) + } + + // Check if .splits file already exists + splitFilePath := path.Join(usr.HomeDir, ".splits") + fileExists := false + if _, err := os.Stat(splitFilePath); err == nil { + fileExists = true + } + + // Only create and clean up the file if it doesn't already exist + if !fileExists { + // Write test data to the .splits file + + testData := []byte("test_feature on\n") + + if err := os.WriteFile(splitFilePath, testData, 0644); err != nil { + t.Fatalf("Error creating .splits file: %v", err) + } + + // Clean up only if we created the file + defer func(name string) { + err := os.Remove(name) + if err != nil { + t.Errorf("Error removing .splits file: %v", err) + } + }(splitFilePath) + } + + // Test the provider creation provider, err := NewProviderSimple("localhost") if err != nil { - t.Error(err) + t.Errorf("Error creating Split Provider: %v", err) } + if provider == nil { - t.Error("Error creating Split Provider") + t.Error("Provider should not be nil") } } @@ -55,15 +97,17 @@ func TestUseDefault(t *testing.T) { flagName := "random-non-existent-feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValue(nil, flagName, false, evalCtx) + time.Sleep(1 * time.Millisecond) + + result, err := ofClient.BooleanValue(context.TODO(), flagName, false, evalCtx) if err == nil { t.Error("Should have returned flag not found error") } else if !strings.Contains(err.Error(), string(openfeature.FlagNotFoundCode)) { - t.Errorf("Unexpected error occurred %s", err.Error()) + t.Errorf("Unexpected error occurred: %s", err.Error()) } else if result == true { t.Error("Result was true, but should have been default value of false") } - result, err = ofClient.BooleanValue(nil, flagName, true, evalCtx) + result, err = ofClient.BooleanValue(context.TODO(), flagName, true, evalCtx) if err == nil { t.Error("Should have returned flag not found error") } else if !strings.Contains(err.Error(), string(openfeature.FlagNotFoundCode)) { @@ -77,7 +121,7 @@ func TestMissingTargetingKey(t *testing.T) { ofClient := create(t) flagName := "random-non-existent-feature" - result, err := ofClient.BooleanValue(nil, flagName, false, openfeature.EvaluationContext{}) + result, err := ofClient.BooleanValue(context.TODO(), flagName, false, openfeature.EvaluationContext{}) if err == nil { t.Error("Should have returned targeting key missing error") } else if !strings.Contains(err.Error(), string(openfeature.TargetingKeyMissingCode)) { @@ -92,7 +136,7 @@ func TestGetControlVariantNonExistentSplit(t *testing.T) { flagName := "random-non-existent-feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValueDetails(nil, flagName, false, evalCtx) + result, err := ofClient.BooleanValueDetails(context.TODO(), flagName, false, evalCtx) if err == nil { t.Error("Should have returned flag not found error") } else if !strings.Contains(err.Error(), string(openfeature.FlagNotFoundCode)) { @@ -109,7 +153,7 @@ func TestGetBooleanSplit(t *testing.T) { flagName := "some_other_feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValue(nil, flagName, true, evalCtx) + result, err := ofClient.BooleanValue(context.TODO(), flagName, true, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result == true { @@ -122,7 +166,7 @@ func TestGetBooleanWithKeySplit(t *testing.T) { flagName := "my_feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValue(nil, flagName, false, evalCtx) + result, err := ofClient.BooleanValue(context.TODO(), flagName, false, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result == false { @@ -130,7 +174,7 @@ func TestGetBooleanWithKeySplit(t *testing.T) { } evalCtx = openfeature.NewEvaluationContext("randomKey", nil) - result, err = ofClient.BooleanValue(nil, flagName, true, evalCtx) + result, err = ofClient.BooleanValue(context.TODO(), flagName, true, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result == true { @@ -143,7 +187,7 @@ func TestGetStringSplit(t *testing.T) { flagName := "some_other_feature" evalCtx := evaluationContext() - result, err := ofClient.StringValue(nil, flagName, "on", evalCtx) + result, err := ofClient.StringValue(context.TODO(), flagName, "on", evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result != "off" { @@ -156,7 +200,7 @@ func TestGetIntegerSplit(t *testing.T) { flagName := "int_feature" evalCtx := evaluationContext() - result, err := ofClient.IntValue(nil, flagName, 0, evalCtx) + result, err := ofClient.IntValue(context.TODO(), flagName, 0, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result != 32 { @@ -169,7 +213,7 @@ func TestGetObjectSplit(t *testing.T) { flagName := "obj_feature" evalCtx := evaluationContext() - result, err := ofClient.ObjectValue(nil, flagName, 0, evalCtx) + result, err := ofClient.ObjectValue(context.TODO(), flagName, 0, evalCtx) expectedResult := map[string]interface{}{ "key": "value", } @@ -185,7 +229,7 @@ func TestGetFloatSplit(t *testing.T) { flagName := "int_feature" evalCtx := evaluationContext() - result, err := ofClient.FloatValue(nil, flagName, 0, evalCtx) + result, err := ofClient.FloatValue(context.TODO(), flagName, 0, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result != float64(32) { @@ -195,7 +239,7 @@ func TestGetFloatSplit(t *testing.T) { func TestMetadataName(t *testing.T) { ofClient := create(t) - if ofClient.Metadata().Name() != "test_client" { + if ofClient.Metadata().Domain() != "test_client" { t.Error("Client name was not set properly") } if openfeature.ProviderMetadata().Name != "Split" { @@ -208,7 +252,7 @@ func TestBooleanDetails(t *testing.T) { flagName := "some_other_feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValueDetails(nil, flagName, true, evalCtx) + result, err := ofClient.BooleanValueDetails(context.TODO(), flagName, true, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result.FlagKey != flagName { @@ -229,7 +273,7 @@ func TestIntegerDetails(t *testing.T) { flagName := "int_feature" evalCtx := evaluationContext() - result, err := ofClient.IntValueDetails(nil, flagName, 0, evalCtx) + result, err := ofClient.IntValueDetails(context.TODO(), flagName, 0, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result.FlagKey != flagName { @@ -250,7 +294,7 @@ func TestStringDetails(t *testing.T) { flagName := "some_other_feature" evalCtx := evaluationContext() - result, err := ofClient.StringValueDetails(nil, flagName, "blah", evalCtx) + result, err := ofClient.StringValueDetails(context.TODO(), flagName, "blah", evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result.FlagKey != flagName { @@ -271,7 +315,7 @@ func TestObjectDetails(t *testing.T) { flagName := "obj_feature" evalCtx := evaluationContext() - result, err := ofClient.ObjectValueDetails(nil, flagName, map[string]interface{}{}, evalCtx) + result, err := ofClient.ObjectValueDetails(context.TODO(), flagName, map[string]interface{}{}, evalCtx) expectedResult := map[string]interface{}{ "key": "value", } @@ -295,7 +339,7 @@ func TestFloatDetails(t *testing.T) { flagName := "int_feature" evalCtx := evaluationContext() - result, err := ofClient.FloatValueDetails(nil, flagName, 0, evalCtx) + result, err := ofClient.FloatValueDetails(context.TODO(), flagName, 0, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result.FlagKey != flagName { @@ -311,7 +355,7 @@ func TestFloatDetails(t *testing.T) { } flagName = "float_feature" - result, err = ofClient.FloatValueDetails(nil, flagName, 0, evalCtx) + result, err = ofClient.FloatValueDetails(context.TODO(), flagName, 0, evalCtx) if err != nil { t.Errorf("Unexpected error occurred %s", err.Error()) } else if result.Value != 32.5 { @@ -329,7 +373,7 @@ func TestBooleanFail(t *testing.T) { flagName := "obj_feature" evalCtx := evaluationContext() - result, err := ofClient.BooleanValue(nil, flagName, false, evalCtx) + result, err := ofClient.BooleanValue(context.TODO(), flagName, false, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -338,7 +382,7 @@ func TestBooleanFail(t *testing.T) { t.Error("Result was true, but should have been default of false") } - resultDetails, err := ofClient.BooleanValueDetails(nil, flagName, false, evalCtx) + resultDetails, err := ofClient.BooleanValueDetails(context.TODO(), flagName, false, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -360,7 +404,7 @@ func TestIntegerFail(t *testing.T) { flagName := "obj_feature" evalCtx := evaluationContext() - result, err := ofClient.IntValue(nil, flagName, 10, evalCtx) + result, err := ofClient.IntValue(context.TODO(), flagName, 10, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -369,7 +413,7 @@ func TestIntegerFail(t *testing.T) { t.Errorf("Result was %d, but should have been default of 10", result) } - resultDetails, err := ofClient.IntValueDetails(nil, flagName, 10, evalCtx) + resultDetails, err := ofClient.IntValueDetails(context.TODO(), flagName, 10, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -391,7 +435,7 @@ func TestFloatFail(t *testing.T) { flagName := "obj_feature" evalCtx := evaluationContext() - result, err := ofClient.FloatValue(nil, flagName, 10, evalCtx) + result, err := ofClient.FloatValue(context.TODO(), flagName, 10, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -400,7 +444,7 @@ func TestFloatFail(t *testing.T) { t.Errorf("Result was %f, but should have been default of 10", result) } - resultDetails, err := ofClient.FloatValueDetails(nil, flagName, 10, evalCtx) + resultDetails, err := ofClient.FloatValueDetails(context.TODO(), flagName, 10, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -425,7 +469,7 @@ func TestObjectFail(t *testing.T) { "key": "value", } - result, err := ofClient.ObjectValue(nil, flagName, defaultTreatment, evalCtx) + result, err := ofClient.ObjectValue(context.TODO(), flagName, defaultTreatment, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { @@ -434,7 +478,7 @@ func TestObjectFail(t *testing.T) { t.Error("Result was not default treatment") } - resultDetails, err := ofClient.ObjectValueDetails(nil, flagName, defaultTreatment, evalCtx) + resultDetails, err := ofClient.ObjectValueDetails(context.TODO(), flagName, defaultTreatment, evalCtx) if err == nil { t.Error("Expected exception to occur") } else if !strings.Contains(err.Error(), string(openfeature.ParseErrorCode)) { diff --git a/sonarqube-project.properties b/sonarqube-project.properties new file mode 100644 index 0000000..0a441d6 --- /dev/null +++ b/sonarqube-project.properties @@ -0,0 +1,7 @@ +sonar.projectKey=split-openfeature-provider-go +sonar.projectName=Split OpenFeature Provider for Go +sonar.projectVersion=1.0.0 + +# Path to source directories +sonar.sources=. +sonar.exclusions=**/*_test.go,**/vendor/**,**/testdata/*