func newRepo(path string) (*repo, error) { pkgs, err := goload.ListPkgs(path) if err != nil { return nil, err } prog, err := goload.Pkgs(pkgs) if err != nil { return nil, err } return &repo{ path: path, pkgs: pkgs, prog: prog, }, nil }
func (p *project) build() { p.lock.Lock() defer p.lock.Unlock() p.clear() // clear the saving slots pkgs, e := goload.ListPkgs(p.path) if p.err(e) { log.Printf("error: %s", e) return } pkgDep := p.buildPkgDep(pkgs) var fileDeps map[string]interface{} var files map[string]*repodb.File prog, e := goload.Pkgs(pkgs) if !p.err(e) { fileDeps = p.buildFileDeps(prog) var es []error files, es = goview.Files(prog) p.err(es...) } p.setPage("INDEX", p.jsonObj(pkgDep)) for pkg, dep := range fileDeps { pkg, e = p.trimPath(pkg) if p.err(e) { continue } p.setPage(pkg, p.jsonObj(dep)) } for path, f := range files { path, e := p.trimPath(path) if p.err(e) { continue } p.setPage(path, f.HTML) } for _, e := range p.errs { log.Printf("error: %s", e) } }