From db50c0fdd3a002e9bcf028f710d929e8f7914103 Mon Sep 17 00:00:00 2001 From: Arnaldo Cesco Date: Wed, 17 Aug 2022 18:27:55 +0200 Subject: [PATCH] Fix lint issue Remove always-nil error from initializeMqttClient function signature Signed-off-by: Arnaldo Cesco --- device/device.go | 7 +------ device/protocol_mqtt_v1.go | 6 ++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/device/device.go b/device/device.go index 2e61d98..49adc94 100644 --- a/device/device.go +++ b/device/device.go @@ -213,12 +213,7 @@ func (d *Device) Connect(result chan<- error) { } // initialize the client - if err = d.initializeMQTTClient(); err != nil { - if result != nil { - result <- err - } - return - } + d.initializeMQTTClient() // Wait for the token - we're in a coroutine anyway // If AutoReconnect is enabled, reconnections will be handled by diff --git a/device/protocol_mqtt_v1.go b/device/protocol_mqtt_v1.go index c987743..a1d4ab7 100644 --- a/device/protocol_mqtt_v1.go +++ b/device/protocol_mqtt_v1.go @@ -42,7 +42,7 @@ func (d *Device) getBaseTopic() string { return fmt.Sprintf("%s/%s", d.realm, d.deviceID) } -func (d *Device) initializeMQTTClient() error { +func (d *Device) initializeMQTTClient() { opts := mqtt.NewClientOptions() opts.AddBroker(d.brokerURL) opts.SetAutoReconnect(d.opts.AutoReconnect) @@ -55,7 +55,7 @@ func (d *Device) initializeMQTTClient() error { opts.SetStore(s) } - // remove TLS config as it will be handled in the custom connection function + // TLS will be handled in the custom connection function opts.SetCustomOpenConnectionFn(d.astarteCustomOpenConnectionFn) opts.SetOnConnectHandler(func(client mqtt.Client, sessionPresent bool) { @@ -78,8 +78,6 @@ func (d *Device) initializeMQTTClient() error { opts.SetDefaultPublishHandler(d.astarteGoSDKDefaultPublishHandler) d.m = mqtt.NewClient(opts) - - return nil } func (d *Device) astarteGoSDKDefaultPublishHandler(client mqtt.Client, msg mqtt.Message) {