Skip to content

Commit

Permalink
Make golangci-lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Jul 9, 2020
1 parent cd4d739 commit 2a3287b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
19 changes: 10 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,16 @@ func (c *Client) streamURL(method, url string, streamOptions streamOptions) erro
return err
}
}
req, err := http.NewRequest(method, url, streamOptions.in)

// make a sub-context so that our active cancellation does not affect parent
ctx := streamOptions.context
if ctx == nil {
ctx = context.Background()
}
subCtx, cancelRequest := context.WithCancel(ctx)
defer cancelRequest()

req, err := http.NewRequestWithContext(ctx, method, url, streamOptions.in)
if err != nil {
return err
}
Expand All @@ -562,14 +571,6 @@ func (c *Client) streamURL(method, url string, streamOptions streamOptions) erro
streamOptions.stderr = ioutil.Discard
}

// make a sub-context so that our active cancellation does not affect parent
ctx := streamOptions.context
if ctx == nil {
ctx = context.Background()
}
subCtx, cancelRequest := context.WithCancel(ctx)
defer cancelRequest()

if protocol == unixProtocol || protocol == namedPipeProtocol {
var dial net.Conn
dial, err = c.Dialer.Dial(protocol, address)
Expand Down
8 changes: 3 additions & 5 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,12 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan
if err != nil {
return err
}
//nolint:staticcheck
conn := httputil.NewClientConn(dial, nil)
req, err := http.NewRequest(http.MethodGet, uri, nil)
conn := httputil.NewClientConn(dial, nil) //nolint:staticcheck
req, err := http.NewRequest(http.MethodGet, uri, nil) //nolint:noctx
if err != nil {
return err
}
//nolint:bodyclose
res, err := conn.Do(req)
res, err := conn.Do(req) //nolint:bodyclose
if err != nil {
return err
}
Expand Down

0 comments on commit 2a3287b

Please sign in to comment.