示例#1
0
文件: main.go 项目: RichardLitt/gx
func updateCollisionCheck(ipkg *gx.Package, idep *gx.Dependency, chain []string) error {
	return ipkg.ForEachDep(func(dep *gx.Dependency, pkg *gx.Package) error {
		if dep == idep {
			return nil
		}

		if dep.Name == idep.Name || dep.Hash == idep.Hash {
			Log("dep %s also imports %s (%s)", strings.Join(chain, "/"), dep.Name, dep.Hash)
			return nil
		}

		return updateCollisionCheck(pkg, idep, append(chain, dep.Name))
	})
}
示例#2
0
文件: ui.go 项目: RichardLitt/gx
func printDepsTree(pm *gx.PM, pkg *gx.Package, quiet bool, indent int) error {
	return pkg.ForEachDep(func(dep *gx.Dependency, dpkg *gx.Package) error {
		label := dep.Hash
		if !quiet {
			label = fmt.Sprintf("%s %s %s", dep.Name, dep.Hash, dep.Version)
		}
		Log("%s%s", strings.Repeat("  ", indent), label)

		err := printDepsTree(pm, dpkg, quiet, indent+1)
		if err != nil {
			return err
		}

		return nil
	})
}