golangci: enable contextcheck linter, fix WSClient

pkg/rpcclient/wsclient.go:93:30  contextcheck  Function `Dial` should pass the context parameter
This commit is contained in:
Roman Khimov 2022-09-02 12:25:51 +03:00
parent 3c009271f8
commit c703ac6805
2 changed files with 2 additions and 1 deletions

View file

@ -43,6 +43,7 @@ linters:
# extra linters
# - exhaustive
- bodyclose
- contextcheck
- gofmt
- whitespace
- goimports

View file

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