Skip to content

Commit

Permalink
Add private method to Client interface to prevent implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-chen committed Aug 19, 2020
1 parent a1c698e commit 47ad801
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client.go
Expand Up @@ -93,6 +93,9 @@ type Client interface {

// Closed returns true if the client has already had Close called on it
Closed() bool

// A private method to prevent users implementing the interface for compatibility
private()
}

const (
Expand Down Expand Up @@ -187,6 +190,8 @@ func NewClient(addrs []string, conf *Config) (Client, error) {
return client, nil
}

func (client *client) private() {}

func (client *client) Config() *Config {
return client.conf
}
Expand Down

1 comment on commit 47ad801

@bgreenlee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for doing this? This is breaking the mock Sarama client we use in tests.

Please sign in to comment.