diff --git a/.golangci.yml b/.golangci.yml index 2fed511a0..b35bc5bd3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -43,6 +43,7 @@ linters: # extra linters # - exhaustive - bodyclose + - contextcheck - gofmt - whitespace - goimports diff --git a/pkg/rpcclient/wsclient.go b/pkg/rpcclient/wsclient.go index d1284716b..3a71d8bb9 100644 --- a/pkg/rpcclient/wsclient.go +++ b/pkg/rpcclient/wsclient.go @@ -90,7 +90,7 @@ var errConnClosedByUser = errors.New("connection closed by user") // operating on. func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error) { dialer := websocket.Dialer{HandshakeTimeout: opts.DialTimeout} - ws, resp, err := dialer.Dial(endpoint, nil) + ws, resp, err := dialer.DialContext(ctx, endpoint, nil) if resp != nil && resp.Body != nil { // Can be non-nil even with error returned. defer resp.Body.Close() // Not exactly required by websocket, but let's do this for bodyclose checker. }