Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gunishmatta committed May 3, 2024
1 parent b6a61e7 commit 3472ee8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions openfeature/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ type IClient interface {

// ClientMetadata provides a client's metadata
type ClientMetadata struct {
domain string
name string
name string
}

// NewClientMetadata constructs ClientMetadata
// Allows for simplified hook test cases while maintaining immutability
func NewClientMetadata(domain string) ClientMetadata {
func NewClientMetadata(name string) ClientMetadata {
return ClientMetadata{
domain: domain,
name: name,
}
}

Expand All @@ -58,7 +57,7 @@ func (cm ClientMetadata) Name() string {

// Domain returns the client's domain
func (cm ClientMetadata) Domain() string {
return cm.domain
return cm.name
}

// Client implements the behaviour required of an openfeature client
Expand All @@ -76,7 +75,7 @@ var _ IClient = (*Client)(nil)
// NewClient returns a new Client. Name is a unique identifier for this client
func NewClient(domain string) *Client {
return &Client{
metadata: ClientMetadata{domain: domain},
metadata: ClientMetadata{name: domain},
hooks: []Hook{},
evaluationContext: EvaluationContext{},
logger: globalLogger,
Expand Down Expand Up @@ -692,7 +691,7 @@ func (c *Client) evaluate(
}

// ensure that the same provider & hooks are used across this transaction to avoid unexpected behaviour
provider, globalHooks, globalCtx := forTransaction(c.metadata.domain)
provider, globalHooks, globalCtx := forTransaction(c.metadata.name)

evalCtx = mergeContexts(evalCtx, c.evaluationContext, globalCtx) // API (global) -> client -> invocation
apiClientInvocationProviderHooks := append(append(append(globalHooks, c.hooks...), options.hooks...), provider.Hooks()...) // API, Client, Invocation, Provider
Expand Down
2 changes: 1 addition & 1 deletion pkg/openfeature/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewClientMetadata(name string) ClientMetadata {
// Deprecated: use github.com/open-feature/go-sdk/openfeature.Client, instead.
type Client = openfeature.Client

// NewClient returns a new Client. Domain is a unique identifier for this client
// NewClient returns a new Client. Name is a unique identifier for this client
//
// Deprecated: use github.com/open-feature/go-sdk/openfeature.NewClient,
// instead.
Expand Down

0 comments on commit 3472ee8

Please sign in to comment.