Skip to content

Commit

Permalink
update module name
Browse files Browse the repository at this point in the history
  • Loading branch information
pulak-opti committed Jan 18, 2024
1 parent d51a3b1 commit 35433e9
Show file tree
Hide file tree
Showing 127 changed files with 375 additions and 368 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ Refer to the [Go SDK's developer documentation](https://docs.developers.optimize

Requires Golang version:

- For v2: 1.21.0 or higher
- For < v2: 1.12 or higher
| SDK Version | Required Golang Version |
|--------------|--------------------------|
| v2.0.0 | 1.21.0 or higher |
| < v2.0.0 | 1.13 or higher |


### Install the SDK

Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/pkg/profile"

"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

func stressTest() {
Expand Down
8 changes: 4 additions & 4 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"fmt"
"time"

optimizely "github.com/optimizely/go-sdk"
"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
optimizely "github.com/optimizely/go-sdk/v2"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
)

func main() {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module github.com/optimizely/go-sdk

module github.com/optimizely/go-sdk/v2
go 1.21.0

require (
Expand Down
4 changes: 2 additions & 2 deletions optimizely.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package optimizely

import (
"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

// Client returns an OptimizelyClient instantiated with the given key and options
Expand Down
28 changes: 14 additions & 14 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (

"github.com/hashicorp/go-multierror"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
pkgReasons "github.com/optimizely/go-sdk/pkg/decision/reasons"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
pkgReasons "github.com/optimizely/go-sdk/v2/pkg/decision/reasons"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

const (
Expand Down
24 changes: 12 additions & 12 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
"github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
"github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

func ValidProjectConfigManager() *MockProjectConfigManager {
Expand Down
24 changes: 12 additions & 12 deletions pkg/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ import (
"errors"
"time"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/metrics"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
pkgUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/registry"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/metrics"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
pkgUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/registry"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

// OptimizelyFactory is used to customize and construct an instance of the OptimizelyClient.
Expand Down
28 changes: 14 additions & 14 deletions pkg/client/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/metrics"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
"github.com/optimizely/go-sdk/pkg/odp/cache"
pkgOdpEvent "github.com/optimizely/go-sdk/pkg/odp/event"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/registry"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/metrics"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
"github.com/optimizely/go-sdk/v2/pkg/odp/cache"
pkgOdpEvent "github.com/optimizely/go-sdk/v2/pkg/odp/event"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/registry"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

type MockRequester struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/client/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ package client
import (
"fmt"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/stretchr/testify/mock"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/optimizely_decision.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package client

import (
"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"
)

// OptimizelyDecision defines the decision returned by decide api.
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/optimizely_decision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"errors"
"testing"

"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"

"github.com/stretchr/testify/suite"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/optimizely_user_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"errors"
"sync"

"github.com/optimizely/go-sdk/pkg/decide"
pkgDecision "github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
"github.com/optimizely/go-sdk/v2/pkg/decide"
pkgDecision "github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
)

// OptimizelyUserContext defines user contexts that the SDK will use to make decisions for.
Expand Down
10 changes: 5 additions & 5 deletions pkg/client/optimizely_user_context_odp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/odp"
"github.com/optimizely/go-sdk/pkg/odp/event"
"github.com/optimizely/go-sdk/pkg/odp/segment"
"github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/odp"
"github.com/optimizely/go-sdk/v2/pkg/odp/event"
"github.com/optimizely/go-sdk/v2/pkg/odp/segment"
)

type OptimizelyUserContextODPTestSuite struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/client/optimizely_user_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"
)

var doOnce sync.Once // required since we only need to read datafile once
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/datafileprojectconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"errors"
"fmt"

"github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/mappers"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/mappers"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/logging"
)

var datafileVersions = map[string]struct{}{
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"path/filepath"
"testing"

"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/logging"

"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/datafileprojectconfig/entities/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Package entities has entity definitions
package entities

import "github.com/optimizely/go-sdk/pkg/entities"
import "github.com/optimizely/go-sdk/v2/pkg/entities"

// Audience represents an Audience object from the Optimizely datafile
type Audience struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/json_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package datafileprojectconfig

import (
"github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"

"github.com/json-iterator/go"
jsoniter "github.com/json-iterator/go"
)

var json = jsoniter.ConfigCompatibleWithStandardLibrary
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/datafileprojectconfig/json_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"
"testing"

"github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/mappers/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package mappers

import (
datafileEntities "github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/pkg/entities"
datafileEntities "github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

// MapAttributes maps the raw datafile attribute entities to SDK Attribute entities
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/mappers/attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package mappers
import (
"testing"

datafileEntities "github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/pkg/entities"
datafileEntities "github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/entities"

"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/mappers/audience.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package mappers

import (
datafileEntities "github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/pkg/entities"
datafileEntities "github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

// MapAudiences maps the raw datafile audience entities to SDK Audience entities
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/mappers/audience_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package mappers
import (
"testing"

datafileEntities "github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/pkg/entities"
datafileEntities "github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/entities"

"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/datafileprojectconfig/mappers/condition_trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"reflect"

jsoniter "github.com/json-iterator/go"
"github.com/optimizely/go-sdk/pkg/decision/evaluator/matchers"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/decision/evaluator/matchers"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

var errEmptyTree = errors.New("empty tree")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package mappers
import (
"testing"

datafileConfig "github.com/optimizely/go-sdk/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/pkg/entities"
datafileConfig "github.com/optimizely/go-sdk/v2/pkg/config/datafileprojectconfig/entities"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading

0 comments on commit 35433e9

Please sign in to comment.