This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git

commit 95d4e20bd742854ec6819a82e9624fcad3f2d7bb
Author: Szymon Janc <[email protected]>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200

    nmxact/nmble: Avoid non-constant format strings in debug logs
    
    Pre-formatted messages were passed to log.Debugf() as the format
    string. Pass them as an argument instead so that any '%' in the
    message is not interpreted, and so that go vet's printf check (run
    as part of go test) passes.
    
    Assisted-by: Claude:claude-opus-5-5
---
 nmxact/nmble/ble_act.go | 10 +++++-----
 nmxact/nmble/conn.go    |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/nmxact/nmble/ble_act.go b/nmxact/nmble/ble_act.go
index 4a398a4..19c7b04 100644
--- a/nmxact/nmble/ble_act.go
+++ b/nmxact/nmble/ble_act.go
@@ -61,7 +61,7 @@ func connect(x *BleXport, bl *Listener, r *BleConnectReq) 
(uint16, error) {
                                        str := fmt.Sprintf("BLE connection 
attempt failed; "+
                                                "status=%s (%d)",
                                                ErrCodeToString(msg.Status), 
msg.Status)
-                                       log.Debugf(str)
+                                       log.Debugf("%s", str)
                                        return 0, 
nmxutil.NewBleHostError(msg.Status, str)
                                }
 
@@ -72,13 +72,13 @@ func connect(x *BleXport, bl *Listener, r *BleConnectReq) 
(uint16, error) {
                                        str := fmt.Sprintf("BLE connection 
attempt failed; "+
                                                "status=%s (%d)",
                                                ErrCodeToString(msg.Status), 
msg.Status)
-                                       log.Debugf(str)
+                                       log.Debugf("%s", str)
                                        return 0, 
nmxutil.NewBleHostError(msg.Status, str)
                                }
 
                        case *BleConnCancelEvt:
                                str := "BLE connection attempt cancelled"
-                               log.Debugf(str)
+                               log.Debugf("%s", str)
                                return 0, fmt.Errorf("%s", str)
 
                        default:
@@ -943,14 +943,14 @@ func advStart(x *BleXport, bl *Listener, stopChan chan 
struct{},
                                        str := fmt.Sprintf("BLE peer failed to 
connect to us; "+
                                                "status=%s (%d)",
                                                ErrCodeToString(msg.Status), 
msg.Status)
-                                       log.Debugf(str)
+                                       log.Debugf("%s", str)
                                        return 0, 
nmxutil.NewBleHostError(msg.Status, str)
                                }
 
                        case *BleAdvCompleteEvt:
                                str := fmt.Sprintf("Advertising stopped; 
reason=%s (%d)",
                                        ErrCodeToString(msg.Reason), msg.Reason)
-                               log.Debugf(str)
+                               log.Debugf("%s", str)
                                return 0, nmxutil.NewBleHostError(msg.Reason, 
str)
 
                        default:
diff --git a/nmxact/nmble/conn.go b/nmxact/nmble/conn.go
index b4c25a1..dd35a9c 100644
--- a/nmxact/nmble/conn.go
+++ b/nmxact/nmble/conn.go
@@ -290,7 +290,7 @@ func (c *Conn) eventListen(bl *Listener) error {
                                                        err := 
StatusError(MSG_OP_EVT,
                                                                
MSG_TYPE_MTU_CHANGE_EVT,
                                                                msg.Status)
-                                                       log.Debugf(err.Error())
+                                                       log.Debugf("%s", 
err.Error())
                                                } else {
                                                        log.Debugf("BLE ATT MTU 
updated; from=%d to=%d",
                                                                c.attMtu, 
msg.Mtu)
@@ -303,7 +303,7 @@ func (c *Conn) eventListen(bl *Listener) error {
                                                        err = 
StatusError(MSG_OP_EVT,
                                                                
MSG_TYPE_ENC_CHANGE_EVT,
                                                                msg.Status)
-                                                       log.Debugf(err.Error())
+                                                       log.Debugf("%s", 
err.Error())
                                                } else {
                                                        log.Debugf("Connection 
encrypted; conn_handle=%d",
                                                                msg.ConnHandle)

Reply via email to