func (p *Project) mapFromTree(tree *git.Tree) (docs map[string]*pb.Document, err error) { var walkErr error docs = make(map[string]*pb.Document, tree.EntryCount()) err = tree.Walk(func(path string, entry *git.TreeEntry) int { // add objects to deployment if entry.Type == git.ObjectBlob { doc, err := p.getDocument(entry.Id) if err != nil { walkErr = err return -1 } path = path + entry.Name docs[path] = doc if walkErr != nil { return -1 } } return 0 }) if err != nil { err = fmt.Errorf("error starting walk: %v", err) } else if walkErr != nil { err = fmt.Errorf("error during walk: %v", walkErr) } return }