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 a9a3b21
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
4 changes: 4 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,9 @@ 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)
}
return sock.Next(&resp)
}

Expand Down
2 changes: 1 addition & 1 deletion codegen/testserver/followschema/models-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/testserver/singlefile/models-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 22 additions & 19 deletions graphql/executable_schema_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9a3b21

Please sign in to comment.