@@ -330,10 +330,10 @@ func (mc *mysqlConn) writeCommandPacket(command commandType, args ...interface{}
330330******************************************************************************/
331331
332332// Returns error if Packet is not an 'Result OK'-Packet
333- func (mc * mysqlConn ) readResultOK () ( err error ) {
333+ func (mc * mysqlConn ) readResultOK () error {
334334 data , err := mc .readPacket ()
335335 if err != nil {
336- return
336+ return err
337337 }
338338
339339 switch data [0 ] {
@@ -342,17 +342,13 @@ func (mc *mysqlConn) readResultOK() (err error) {
342342 return mc .handleOkPacket (data )
343343 // EOF, someone is using old_passwords
344344 case 254 :
345- err = errors .New ("It seems like you are using old_passwords, which is unsupported. See https://github.com/Go-SQL-Driver/MySQL/wiki/old_passwords" )
346- return
345+ return errors .New ("It seems like you are using old_passwords, which is unsupported. See https://github.com/Go-SQL-Driver/MySQL/wiki/old_passwords" )
347346 // ERROR
348347 case 255 :
349348 return mc .handleErrorPacket (data )
350- default :
351- err = errors .New ("Invalid Result Packet-Type" )
352- return
353349 }
354350
355- return
351+ return errors . New ( "Invalid Result Packet-Type" )
356352}
357353
358354/* Error Packet
@@ -364,10 +360,9 @@ Bytes Name
3643605 sqlstate (5 characters)
365361n message
366362*/
367- func (mc * mysqlConn ) handleErrorPacket (data []byte ) ( err error ) {
363+ func (mc * mysqlConn ) handleErrorPacket (data []byte ) error {
368364 if data [0 ] != 255 {
369- err = errors .New ("Wrong Packet-Type: Not an Error-Packet" )
370- return
365+ return errors .New ("Wrong Packet-Type: Not an Error-Packet" )
371366 }
372367
373368 pos := 1
@@ -383,8 +378,7 @@ func (mc *mysqlConn) handleErrorPacket(data []byte) (err error) {
383378 // Error Message [string]
384379 message := string (data [pos :])
385380
386- err = fmt .Errorf ("Error %d: %s" , errno , message )
387- return
381+ return fmt .Errorf ("Error %d: %s" , errno , message )
388382}
389383
390384/* Ok Packet
@@ -604,7 +598,7 @@ func (mc *mysqlConn) readRow(columnsCount int) (*[]*[]byte, error) {
604598 return & row , nil
605599}
606600
607- // Reads Packets Packets until EOF-Packet or an Error appears. Returns count of Packets read
601+ // Reads Packets until EOF-Packet or an Error appears. Returns count of Packets read
608602func (mc * mysqlConn ) readUntilEOF () (count uint64 , err error ) {
609603 var data []byte
610604
0 commit comments