aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/mqtt/main.go6
-rw-r--r--examples/radio/main.go3
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/mqtt/main.go b/examples/mqtt/main.go
index 35058d4..742c396 100644
--- a/examples/mqtt/main.go
+++ b/examples/mqtt/main.go
@@ -3,7 +3,6 @@ package main
import (
"encoding/base64"
"encoding/hex"
- "fmt"
"github.com/charmbracelet/log"
pb "github.com/meshnet-gophers/meshtastic-go/meshtastic"
"github.com/meshnet-gophers/meshtastic-go/mqtt"
@@ -43,6 +42,9 @@ func channelHandler(channel string) mqtt.HandlerFunc {
}
var message pb.Data
err = proto.Unmarshal(decodedMessage, &message)
+ if err != nil {
+ log.Error(err)
+ }
log.Info(processMessage(&message), "topic", m.Topic, "channel", channel, "portnum", message.Portnum.String())
}
@@ -75,7 +77,7 @@ func processMessage(message *pb.Data) string {
return s.String()
}
- return fmt.Sprintf("unknown message type")
+ return "unknown message type"
}
func generateKey(key string) ([]byte, error) {
diff --git a/examples/radio/main.go b/examples/radio/main.go
index 5b438f1..0d83d79 100644
--- a/examples/radio/main.go
+++ b/examples/radio/main.go
@@ -2,7 +2,6 @@ package main
import (
"context"
- "fmt"
"github.com/charmbracelet/log"
pb "github.com/meshnet-gophers/meshtastic-go/meshtastic"
"github.com/meshnet-gophers/meshtastic-go/transport"
@@ -83,5 +82,5 @@ func processMessage(message *pb.Data) string {
return s.String()
}
- return fmt.Sprintf("unknown message type")
+ return "unknown message type"
}