mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 15:23:29 +03:00
Name return values to prevent the need (and unnecessary code bloat) (#4576)
This is done to explicitly instantiate objects for every return statement.
This commit is contained in:
committed by
Harshavardhana
parent
cec8b238f3
commit
46897b1100
+4
-4
@@ -69,9 +69,9 @@ type natsIOConn struct {
|
||||
// dialNATS - dials and returns an natsIOConn instance,
|
||||
// for sending notifications. Returns error if nats logger
|
||||
// is not enabled.
|
||||
func dialNATS(natsL natsNotify, testDial bool) (natsIOConn, error) {
|
||||
func dialNATS(natsL natsNotify, testDial bool) (nioc natsIOConn, e error) {
|
||||
if !natsL.Enable {
|
||||
return natsIOConn{}, errNotifyNotEnabled
|
||||
return nioc, errNotifyNotEnabled
|
||||
}
|
||||
|
||||
// Construct natsIOConn which holds all NATS connection information
|
||||
@@ -105,7 +105,7 @@ func dialNATS(natsL natsNotify, testDial bool) (natsIOConn, error) {
|
||||
// Do the real connection to the NATS server
|
||||
sc, err := stan.Connect(natsL.Streaming.ClusterID, clientID, connOpts...)
|
||||
if err != nil {
|
||||
return natsIOConn{}, err
|
||||
return nioc, err
|
||||
}
|
||||
// Save the created connection
|
||||
conn.stanConn = sc
|
||||
@@ -120,7 +120,7 @@ func dialNATS(natsL natsNotify, testDial bool) (natsIOConn, error) {
|
||||
// Do the real connection
|
||||
nc, err := natsC.Connect()
|
||||
if err != nil {
|
||||
return natsIOConn{}, err
|
||||
return nioc, err
|
||||
}
|
||||
// Save the created connection
|
||||
conn.natsConn = nc
|
||||
|
||||
Reference in New Issue
Block a user