errcheck; sort some stuff out

This commit is contained in:
Zach Ramsay
2017-10-03 18:49:20 -04:00
committed by Ethan Buchman
parent 563faa98de
commit d7cb291fb2
26 changed files with 61 additions and 154 deletions

View File

@ -93,7 +93,7 @@ func (c *JSONRPCClient) Call(method string, params map[string]interface{}, resul
if err != nil {
return nil, err
}
defer httpResponse.Body.Close() // nolint (errcheck)
defer httpResponse.Body.Close() // nolint: errcheck
responseBytes, err := ioutil.ReadAll(httpResponse.Body)
if err != nil {
@ -129,7 +129,7 @@ func (c *URIClient) Call(method string, params map[string]interface{}, result in
if err != nil {
return nil, err
}
defer resp.Body.Close() // nolint (errcheck)
defer resp.Body.Close() // nolint: errcheck
responseBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {

View File

@ -354,7 +354,7 @@ func (c *WSClient) writeRoutine() {
ticker.Stop()
if err := c.conn.Close(); err != nil {
// ignore error; it will trigger in tests
// likely because it's closing and already closed connection
// likely because it's closing an already closed connection
}
c.wg.Done()
}()
@ -406,7 +406,7 @@ func (c *WSClient) readRoutine() {
defer func() {
if err := c.conn.Close(); err != nil {
// ignore error; it will trigger in tests
// likely because it's closing and already closed connection
// likely because it's closing an already closed connection
}
c.wg.Done()
}()

View File

@ -34,11 +34,7 @@ func (h *myHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err != nil {
panic(err)
}
defer func() {
if err := conn.Close(); err != nil {
panic(err)
}
}()
defer conn.Close() // nolint: errcheck
for {
messageType, _, err := conn.ReadMessage()
if err != nil {