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:
parent
3c009271f8
commit
c703ac6805
2 changed files with 2 additions and 1 deletions
|
@ -43,6 +43,7 @@ linters:
|
|||
# extra linters
|
||||
# - exhaustive
|
||||
- bodyclose
|
||||
- contextcheck
|
||||
- gofmt
|
||||
- whitespace
|
||||
- goimports
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue