diff options
Diffstat (limited to 'mt4')
-rw-r--r-- | mt4/client.go | 8 | ||||
-rw-r--r-- | mt4/client_test.go | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/mt4/client.go b/mt4/client.go index 8a5f388..74fceee 100644 --- a/mt4/client.go +++ b/mt4/client.go @@ -3,7 +3,6 @@ package mt4 import ( "context" "fmt" - "net" "time" "go.popov.link/metatrader4/internal/conn" @@ -18,7 +17,6 @@ type Client struct { readTimeout time.Duration writeTimeout time.Duration autoClose bool - dialer net.Dialer c *conn.Conn } @@ -86,7 +84,7 @@ func (c *Client) Execute(ctx context.Context, command string, params map[string] encoded, err := proto.EncodeParams(params) if err != nil { if c.autoClose { - c.Close() + _ = c.Close() } return "", err } @@ -94,14 +92,14 @@ func (c *Client) Execute(ctx context.Context, command string, params map[string] if err := c.c.Send(ctx, req, c.writeTimeout); err != nil { if c.autoClose { - c.Close() + _ = c.Close() } return "", fmt.Errorf("send: %w", err) } respBytes, err := c.c.Receive(ctx, c.readTimeout) if c.autoClose { - c.Close() + _ = c.Close() } if err != nil { return "", fmt.Errorf("receive: %w", err) diff --git a/mt4/client_test.go b/mt4/client_test.go index 9644c9a..2ff5417 100644 --- a/mt4/client_test.go +++ b/mt4/client_test.go @@ -15,10 +15,10 @@ import ( func mockServer(response string) (net.Conn, net.Conn) { server, client := net.Pipe() go func() { - defer server.Close() + defer func() { _ = server.Close() }() buf := make([]byte, 1024) - server.Read(buf) // read request ignoring - server.Write([]byte(response)) + _, _ = server.Read(buf) // read request ignoring + _, _ = server.Write([]byte(response)) }() return client, server } |