ccollins476ad commented on a change in pull request #140: newt - Repo 
dependencies
URL: https://github.com/apache/mynewt-newt/pull/140#discussion_r172954881
 
 

 ##########
 File path: newt/repo/repo.go
 ##########
 @@ -596,18 +499,18 @@ func (r *Repo) Sync(vers *Version, force bool) (bool, 
error) {
                msg := "Unexpected local branch for %s: \"%s\" != \"%s\""
                if force {
                        util.StatusMessage(util.VERBOSITY_DEFAULT,
-                               msg+"\n", r.rdesc.name, currBranch, branchName)
+                               msg+"\n", r.Name(), currBranch, branchName)
                } else {
-                       err = util.FmtNewtError(
-                               msg, r.rdesc.name, currBranch, branchName)
+                       err := util.FmtNewtError(
+                               msg, r.Name(), currBranch, branchName)
 
 Review comment:
   Since this `err` is declared in a child scope, it shadows the earlier 
declaration.  This is analogous to the C code:
   
   ```
   int err = 10;
   while (keep_going()) {
       int err = 20;
       /* err == 20 */
   }
   /* err == 10 */
   ```
   
   I think shadowing a variable declaration can be confusing, and is probably 
best avoided.  In the case of an `err` variable, I don't think there is that 
much room for confusion, however.  Though, in this case, I don't think the 
second `err` variable should be declared at all, so I am going to change it to:
   
   ```
               return false, util.FmtNewtError(
                   msg, r.Name(), currBranch, branchName)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to