Skip to content

Commit

Permalink
Fix lint issue
Browse files Browse the repository at this point in the history
Remove always-nil error from initializeMqttClient function signature

Signed-off-by: Arnaldo Cesco <[email protected]>
  • Loading branch information
Annopaolo committed Aug 17, 2022
1 parent 6b5a399 commit db50c0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
7 changes: 1 addition & 6 deletions device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions device/protocol_mqtt_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit db50c0f

Please sign in to comment.