Beispiel #1
0
func (p *project) buildFileDeps(prog *goload.Program) map[string]interface{} {
	pkgDeps := godep.FileDepLoaded(prog)

	ret := make(map[string]interface{})
	for pkg, g := range pkgDeps {
		m, e := dagvis.Layout(g)
		if p.err(e) {
			continue
		}
		ret[pkg] = dagvis.JSONMap(m)
	}

	return ret
}
Beispiel #2
0
func (r *repo) pkgDeps() (interface{}, error) {
	g, err := godep.PkgDep(r.pkgs)
	if err != nil {
		return nil, err
	}

	g, err = g.Rename(r.trimPath)
	if err != nil {
		return nil, err
	}
	m, err := dagvis.Layout(g)
	if err != nil {
		return nil, err
	}
	return dagvis.JSONMap(m), nil
}
Beispiel #3
0
func (p *project) buildPkgDep(pkgs []string) interface{} {
	g, e := godep.PkgDep(pkgs)
	if p.err(e) {
		return nil
	}

	g, e = g.Rename(p.trimPath)
	if p.err(e) {
		return nil
	}

	m, e := dagvis.Layout(g)
	if p.err(e) {
		return nil
	}

	return dagvis.JSONMap(m)
}
Beispiel #4
0
func (r *repo) fileDeps() (map[string]interface{}, []error) {
	deps := godep.FileDepLoaded(r.prog)

	var errs []error
	ret := make(map[string]interface{})
	for pkg, dep := range deps {
		m, err := dagvis.Layout(dep)
		if err != nil {
			errs = append(errs, err)
			continue
		}
		p, err := r.trimPath(pkg)
		if err != nil {
			errs = append(errs, err)
			continue
		}
		ret[p] = dagvis.JSONMap(m)
	}
	return ret, errs
}