Skip to content

Commit

Permalink
Avoid double pointer
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Coffman <steve@khanacademy.org>
  • Loading branch information
StevenACoffman committed Sep 21, 2022
1 parent a87ba17 commit 9fd55d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"net/http/httptest"
"reflect"
"strings"

"github.com/gorilla/websocket"
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 9fd55d1

Please sign in to comment.