func HandlePkgStats(repo *git.Repository,
	w http.ResponseWriter, req *http.Request) error {
	res, err := NewPkgStats(repo)
	if err != nil {
		return err
	}
	return util.RespondJSON(w, 200, res)
}
HandlePkgStats retrieves the current memory stats.
package registry
import (
	"github.com/alexanderGugel/nerva/util"
	"github.com/libgit2/git2go"
	"net/http"
	"runtime"
)
type PkgStats struct {
	Remotes []*PkgRemote `json:"remotes"`
}
type PkgRemote struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}
func NewPkgStats(repo *git.Repository) (*PkgStats, error) {
	names, err := repo.Remotes.List()
	if err != nil {
		return nil, err
	}
	remotes := []*PkgRemote{}
	for _, name := range names {
		remote, err := repo.Remotes.Lookup(name)
		if err != nil {
			return nil, err
		}
		url := remote.Url()
		remotes = append(remotes, &PkgRemote{name, url})
	}
	stats := &PkgStats{remotes}
	return stats, nil
}