mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
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
|
# extra linters
|
||||||
# - exhaustive
|
# - exhaustive
|
||||||
- bodyclose
|
- bodyclose
|
||||||
|
- contextcheck
|
||||||
- gofmt
|
- gofmt
|
||||||
- whitespace
|
- whitespace
|
||||||
- goimports
|
- goimports
|
||||||
|
|
|
@ -90,7 +90,7 @@ var errConnClosedByUser = errors.New("connection closed by user")
|
||||||
// operating on.
|
// operating on.
|
||||||
func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error) {
|
func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error) {
|
||||||
dialer := websocket.Dialer{HandshakeTimeout: opts.DialTimeout}
|
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.
|
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.
|
defer resp.Body.Close() // Not exactly required by websocket, but let's do this for bodyclose checker.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue