Просмотр исходного кода

Add private method to Client interface to prevent implementation

Justin Chen 4 лет назад
Родитель
Сommit
47ad801aa8
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      client.go

+ 5 - 0
client.go

@@ -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 (
@@ -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
 }