Browse Source

Bug fix

pull/103/head
Unknown 11 years ago
parent
commit
a7125daad6
  1. 2
      cmd/gen.go
  2. 4
      cmd/get.go
  3. 25
      doc/utils.go
  4. 2
      gopm.go

2
cmd/gen.go

@ -57,7 +57,7 @@ func runGen(ctx *cli.Context) {
targetPath := parseTarget(gf.MustValue("target", "path")) targetPath := parseTarget(gf.MustValue("target", "path"))
// Get dependencies. // Get dependencies.
imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example")) imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example"))
log.Log("%v", imports)
for _, p := range imports { for _, p := range imports {
p = doc.GetProjectPath(p) p = doc.GetProjectPath(p)
// Skip subpackage(s) of current project. // Skip subpackage(s) of current project.

4
cmd/get.go

@ -233,8 +233,8 @@ func downloadPackages(ctx *cli.Context, nodes []*doc.Node) {
n.ImportPath, n.Type, doc.CheckNodeValue(n.Value)) n.ImportPath, n.Type, doc.CheckNodeValue(n.Value))
// Only copy when no version control. // Only copy when no version control.
if ctx.Bool("gopath") && com.IsExist(installPath) || if ctx.Bool("gopath") && (com.IsExist(installPath) ||
len(getVcsName(gopathDir)) == 0 { len(getVcsName(gopathDir)) == 0) {
copyToGopath(installPath, gopathDir) copyToGopath(installPath, gopathDir)
} }
continue continue

25
doc/utils.go

@ -56,26 +56,27 @@ func GetImports(absPath, importPath string, example bool) []string {
} }
} }
//fis := GetDirsInfo(absPath) fis := GetDirsInfo(absPath)
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)) imports := make([]string, 0, len(pkg.Imports))
for _, p := range pkg.Imports { for _, p := range pkg.Imports {
if !IsGoRepoPath(p) && !strings.HasPrefix(p, importPath) { if !IsGoRepoPath(p) && !strings.HasPrefix(p, importPath) {
imports = append(imports, p) 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 return imports
} }

2
gopm.go

@ -29,7 +29,7 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition. // Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true const go11tag = true
const APP_VER = "0.6.3.0301" const APP_VER = "0.6.3.0311"
// //cmd.CmdSearch, // //cmd.CmdSearch,
// cmdClean, // cmdClean,

Loading…
Cancel
Save