You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/04 20:33:03 UTC

[46/50] [abbrv] incubator-mynewt-newt git commit: Fix check for whether package is inside multiple pkg-lists.

Fix check for whether package is inside multiple pkg-lists.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/0843cc67
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/0843cc67
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/0843cc67

Branch: refs/heads/master
Commit: 0843cc67dba5cc7156cc69dbad6f80968c99facc
Parents: 6740186
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Mar 2 16:40:41 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Mar 2 16:40:41 2016 -0800

----------------------------------------------------------------------
 newt/newt.go | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0843cc67/newt/newt.go
----------------------------------------------------------------------
diff --git a/newt/newt.go b/newt/newt.go
index d64b9ee..c052fa1 100644
--- a/newt/newt.go
+++ b/newt/newt.go
@@ -990,14 +990,18 @@ func pkgInstallCmd(cmd *cobra.Command, args []string) {
 	for _, tmpPkgList := range pkgLists {
 		if pkgListName == "" || tmpPkgList.Name == pkgListName {
 			tmpPkgDesc, err := tmpPkgList.ResolvePkgDescName(pkgName)
-			if err != nil && pkgDesc != nil {
-				NewtUsage(cmd,
-					cli.NewNewtError(fmt.Sprintf("Ambiguous source "+
-						"pkg %s in package-list %s and %s",
-						pkgName, pkgList.Name, tmpPkgList.Name)))
-			} else {
-				pkgDesc = tmpPkgDesc
-				pkgList = tmpPkgList
+			if err == nil {
+				if pkgDesc != nil {
+					NewtUsage(cmd,
+						cli.NewNewtError(fmt.Sprintf("Ambiguous "+
+						"source pkg %s in package-list %s and "+
+						"%s %s",
+						pkgName, pkgList.Name, tmpPkgList.Name,
+						tmpPkgDesc.FullName)))
+				} else {
+					pkgDesc = tmpPkgDesc
+					pkgList = tmpPkgList
+				}
 			}
 		}
 	}