From 9fd55d12f8580d4383f3b37692f19cb79b26ab6a Mon Sep 17 00:00:00 2001 From: Steve Coffman Date: Wed, 21 Sep 2022 09:45:31 -0400 Subject: [PATCH] Avoid double pointer Signed-off-by: Steve Coffman --- client/websocket.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/websocket.go b/client/websocket.go index 016691e10c0..69d263f789a 100644 --- a/client/websocket.go +++ b/client/websocket.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http/httptest" + "reflect" "strings" "github.com/gorilla/websocket" @@ -47,6 +48,10 @@ func (p *Client) Websocket(query string, options ...Option) *Subscription { func (p *Client) WebsocketOnce(query string, resp interface{}, options ...Option) error { sock := p.Websocket(query, options...) defer sock.Close() + if reflect.ValueOf(resp).Kind() == reflect.Ptr { + return sock.Next(resp) + } + //TODO: verify this is never called and remove it return sock.Next(&resp) }