Skip to content

Commit 0f5d83a

Browse files
Use explicit return in handleAuthResult.
1 parent 0da0f4e commit 0f5d83a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

driver.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ func (d MySQLDriver) Open(dsn string) (driver.Conn, error) {
124124
return mc, nil
125125
}
126126

127-
func handleAuthResult(mc *mysqlConn, cipher []byte) (err error) {
127+
func handleAuthResult(mc *mysqlConn, cipher []byte) error {
128128
// Read Result Packet
129-
err = mc.readResultOK()
129+
err := mc.readResultOK()
130130
if err == nil {
131-
return // auth successful
131+
return nil // auth successful
132132
}
133133

134134
if mc.cfg == nil {
135-
return // auth failed and retry not possible
135+
return err // auth failed and retry not possible
136136
}
137137

138138
// Retry auth if configured to do so.
@@ -141,19 +141,19 @@ func handleAuthResult(mc *mysqlConn, cipher []byte) (err error) {
141141
// where this should work but doesn't; this is currently "wontfix":
142142
// https://github.com/go-sql-driver/mysql/issues/184
143143
if err = mc.writeOldAuthPacket(cipher); err != nil {
144-
return
144+
return err
145145
}
146146
err = mc.readResultOK()
147147
} else if mc.cfg.allowCleartextPasswords && err == ErrCleartextPassword {
148148
// Retry with clear text password for
149149
// http://dev.mysql.com/doc/refman/5.7/en/cleartext-authentication-plugin.html
150150
// http://dev.mysql.com/doc/refman/5.7/en/pam-authentication-plugin.html
151151
if err = mc.writeClearAuthPacket(); err != nil {
152-
return
152+
return err
153153
}
154154
err = mc.readResultOK()
155155
}
156-
return
156+
return err
157157
}
158158

159159
func init() {

0 commit comments

Comments
 (0)