mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 00:03: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
+3
-3
@@ -50,9 +50,9 @@ type mqttConn struct {
|
||||
Client MQTT.Client
|
||||
}
|
||||
|
||||
func dialMQTT(mqttL mqttNotify) (mqttConn, error) {
|
||||
func dialMQTT(mqttL mqttNotify) (mc mqttConn, e error) {
|
||||
if !mqttL.Enable {
|
||||
return mqttConn{}, errNotifyNotEnabled
|
||||
return mc, errNotifyNotEnabled
|
||||
}
|
||||
connOpts := &MQTT.ClientOptions{
|
||||
ClientID: mqttL.ClientID,
|
||||
@@ -66,7 +66,7 @@ func dialMQTT(mqttL mqttNotify) (mqttConn, error) {
|
||||
connOpts.AddBroker(mqttL.Broker)
|
||||
client := MQTT.NewClient(connOpts)
|
||||
if token := client.Connect(); token.Wait() && token.Error() != nil {
|
||||
return mqttConn{}, token.Error()
|
||||
return mc, token.Error()
|
||||
}
|
||||
return mqttConn{Client: client, params: mqttL}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user