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-newt.git
commit e436dfc30e5c55aeecb13bbd72ac65189c15c3e2 Author: Szymon Janc <[email protected]> AuthorDate: Thu Oct 15 18:02:21 2026 +0200 newt: Fix wrong arguments in formatted messages Fix messages that were printed incorrectly: - invalid repo version in newt compatibility table was not printed, - 'any' priority value was printed with %s instead of %d, - ycfg node name was missing, so %s printed the node value and %T printed nothing, - invalid restriction and flash conflict codes were converted to a single rune string instead of a number. Found by go vet. Assisted-by: Claude:claude-opus-5-5 --- newt/compat/compat.go | 4 ++-- newt/resolve/expr.go | 2 +- newt/syscfg/restrict.go | 2 +- newt/syscfg/syscfg.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/newt/compat/compat.go b/newt/compat/compat.go index f86144d9..4034ff66 100644 --- a/newt/compat/compat.go +++ b/newt/compat/compat.go @@ -111,8 +111,8 @@ func ReadNcMap(yc ycfg.YCfg) (NewtCompatMap, error) { for k, v := range ncMap { repoVer, err := newtutil.ParseVersion(k) if err != nil { - return nil, util.FmtNewtError("Newt compatibility table contains " + - "invalid repo version \"%s\"") + return nil, util.FmtNewtError("Newt compatibility table contains "+ + "invalid repo version \"%s\"", k) } if _, ok := mp[repoVer]; ok { diff --git a/newt/resolve/expr.go b/newt/resolve/expr.go index fdebd811..24d9b5a8 100644 --- a/newt/resolve/expr.go +++ b/newt/resolve/expr.go @@ -48,7 +48,7 @@ func getExprMapStringSlice( if err != nil { return nil, warning, util.FmtNewtError( "ycfg node \"%s\" contains unexpected type; "+ - "have=%T want=[]string", e.Value) + "have=%T want=[]string", key, e.Value) } m[e.Expr] = append(m[e.Expr], slice...) diff --git a/newt/syscfg/restrict.go b/newt/syscfg/restrict.go index 0cdb5eb3..6c70498a 100644 --- a/newt/syscfg/restrict.go +++ b/newt/syscfg/restrict.go @@ -342,7 +342,7 @@ func (cfg *Cfg) restrictionMet( return val default: - panic("Invalid restriction code: " + string(r.Code)) + panic(fmt.Sprintf("Invalid restriction code: %d", r.Code)) } } diff --git a/newt/syscfg/syscfg.go b/newt/syscfg/syscfg.go index 7e74c049..87619402 100644 --- a/newt/syscfg/syscfg.go +++ b/newt/syscfg/syscfg.go @@ -949,7 +949,7 @@ func (cfg *Cfg) flashConflictErrorText(conflict CfgFlashConflict) string { entry.Value) default: - panic("Invalid flash conflict code: " + string(conflict.Code)) + panic(fmt.Sprintf("Invalid flash conflict code: %d", conflict.Code)) } } @@ -1413,7 +1413,7 @@ func calcPriorities(cfg Cfg, settingType CfgSettingType, max int, greatest++ if greatest > max { return util.FmtNewtError("could not assign 'any' priority: "+ - "value too great (> %d); setting=%s value=%s pkg=%s", + "value too great (> %d); setting=%s value=%d pkg=%s", max, name, greatest, mostRecentPoint(entry).Name()) }
