style: update some code to fit go 1.19

This commit is contained in:
Li4n0
2022-09-14 01:05:24 +08:00
parent 4cd232f7e0
commit fe316220a1
8 changed files with 514 additions and 643 deletions
+14 -14
View File
@@ -247,23 +247,23 @@ func (c *Conn) parseRow(data []byte, fields []*querypb.Field) ([]sqltypes.Value,
//
// 1. if the server closes the connection when no command is in flight:
//
// 1.1 unix: WriteComQuery will fail with a 'broken pipe', and we'll
// return CRServerGone(2006).
// 1.1 unix: WriteComQuery will fail with a 'broken pipe', and we'll
// return CRServerGone(2006).
//
// 1.2 tcp: WriteComQuery will most likely work, but readComQueryResponse
// will fail, and we'll return CRServerLost(2013).
// 1.2 tcp: WriteComQuery will most likely work, but readComQueryResponse
// will fail, and we'll return CRServerLost(2013).
//
// This is because closing a TCP socket on the server side sends
// a FIN to the client (telling the client the server is done
// writing), but on most platforms doesn't send a RST. So the
// client has no idea it can't write. So it succeeds writing data, which
// *then* triggers the server to send a RST back, received a bit
// later. By then, the client has already started waiting for
// the response, and will just return a CRServerLost(2013).
// So CRServerGone(2006) will almost never be seen with TCP.
// This is because closing a TCP socket on the server side sends
// a FIN to the client (telling the client the server is done
// writing), but on most platforms doesn't send a RST. So the
// client has no idea it can't write. So it succeeds writing data, which
// *then* triggers the server to send a RST back, received a bit
// later. By then, the client has already started waiting for
// the response, and will just return a CRServerLost(2013).
// So CRServerGone(2006) will almost never be seen with TCP.
//
// 2. if the server closes the connection when a command is in flight,
// readComQueryResponse will fail, and we'll return CRServerLost(2013).
// 2. if the server closes the connection when a command is in flight,
// readComQueryResponse will fail, and we'll return CRServerLost(2013).
func (c *Conn) ExecuteFetch(query string, maxrows int, wantfields bool) (result *sqltypes.Result, err error) {
result, _, err = c.ExecuteFetchMulti(query, maxrows, wantfields)
return result, err