From a7125daad6aa64fd5645081b47d1db0de6d45753 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 11 Mar 2014 23:28:45 -0400 Subject: [PATCH] Bug fix --- cmd/gen.go | 2 +- cmd/get.go | 4 ++-- doc/utils.go | 25 +++++++++++++------------ gopm.go | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmd/gen.go b/cmd/gen.go index 6abd821d8..314a65e9e 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -57,7 +57,7 @@ func runGen(ctx *cli.Context) { targetPath := parseTarget(gf.MustValue("target", "path")) // Get dependencies. imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example")) - + log.Log("%v", imports) for _, p := range imports { p = doc.GetProjectPath(p) // Skip subpackage(s) of current project. diff --git a/cmd/get.go b/cmd/get.go index 7742d2d2d..fac5890f6 100644 --- a/cmd/get.go +++ b/cmd/get.go @@ -233,8 +233,8 @@ func downloadPackages(ctx *cli.Context, nodes []*doc.Node) { n.ImportPath, n.Type, doc.CheckNodeValue(n.Value)) // Only copy when no version control. - if ctx.Bool("gopath") && com.IsExist(installPath) || - len(getVcsName(gopathDir)) == 0 { + if ctx.Bool("gopath") && (com.IsExist(installPath) || + len(getVcsName(gopathDir)) == 0) { copyToGopath(installPath, gopathDir) } continue diff --git a/doc/utils.go b/doc/utils.go index 327a29dea..558ab2ac9 100644 --- a/doc/utils.go +++ b/doc/utils.go @@ -56,26 +56,27 @@ func GetImports(absPath, importPath string, example bool) []string { } } - //fis := GetDirsInfo(absPath) + fis := GetDirsInfo(absPath) absPath += "/" - // Load too much, skip for now. - // dirs := make([]string, 0) - // for _, fi := range fis { - // if fi.IsDir() && !strings.Contains(fi.Name(), VENDOR) { - // dirs = append(dirs, absPath+fi.Name()) - // } - // } - imports := make([]string, 0, len(pkg.Imports)) for _, p := range pkg.Imports { if !IsGoRepoPath(p) && !strings.HasPrefix(p, importPath) { imports = append(imports, p) } } - // if len(dirs) > 0 { - // imports = append(imports, GetAllImports(dirs, importPath, example)...) - // } + + // TODO: Load too much + dirs := make([]string, 0, len(imports)) + for _, fi := range fis { + if fi.IsDir() && !strings.Contains(fi.Name(), VENDOR) { + dirs = append(dirs, absPath+fi.Name()) + } + } + + if len(dirs) > 0 { + imports = append(imports, GetAllImports(dirs, importPath, example)...) + } return imports } diff --git a/gopm.go b/gopm.go index 5f00d2467..1b454ce47 100644 --- a/gopm.go +++ b/gopm.go @@ -29,7 +29,7 @@ import ( // Test that go1.1 tag above is included in builds. main.go refers to this definition. const go11tag = true -const APP_VER = "0.6.3.0301" +const APP_VER = "0.6.3.0311" // //cmd.CmdSearch, // cmdClean,