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 82d5ccf68cace568b3ee6a6bb647447b12ecf388
Author: Szymon Janc <[email protected]>
AuthorDate: Fri Oct 9 15:11:11 2026 +0200

    newt/cli: Fix testable packages cache
    
    testablePkgs() declared a local variable shadowing the global
    testablePkgMap, so the cache was never populated and the package
    tree was walked on every call.
    
    Assisted-by: Claude:claude-opus-5-5
---
 newt/cli/build_cmds.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go
index 3d0197c3..406080fa 100644
--- a/newt/cli/build_cmds.go
+++ b/newt/cli/build_cmds.go
@@ -45,14 +45,14 @@ func testablePkgs() map[*pkg.LocalPackage]struct{} {
                return testablePkgMap
        }
 
-       testablePkgMap := map[*pkg.LocalPackage]struct{}{}
-
        // Create a map of path => lclPkg.
        proj, err := project.TryGetProject()
        if err != nil {
                return nil
        }
 
+       testablePkgMap = map[*pkg.LocalPackage]struct{}{}
+
        allPkgs := proj.PackagesOfType(-1)
        pathLpkgMap := make(map[string]*pkg.LocalPackage, len(allPkgs))
        for _, p := range allPkgs {

Reply via email to