climbing up hill

This commit is contained in:
Jeff Carr 2024-11-28 08:54:47 -06:00
parent 5a9b953d33
commit 02b9ed57b3
3 changed files with 8 additions and 16 deletions

View File

@ -17,6 +17,7 @@ lint:
# autofixes your import headers in your golang files
goimports:
goimports -w *.go
make -C scanGoSrc/ goimports
redomod:
rm -f go.*

View File

@ -35,7 +35,7 @@ func (it *RepoIterator) Scan() bool {
}
// Repo returns the current repo.
func (it *RepoIterator) Repo() *Repo {
func (it *RepoIterator) Next() *Repo {
if it.packs[it.index-1] == nil {
for i, d := range it.packs {
fmt.Println("i =", i, d)
@ -61,10 +61,10 @@ func (r *Repos) All() *RepoIterator {
return iterator
}
func (r *Repos) SortByName() *RepoIterator {
func (r *Repos) SortByPath() *RepoIterator {
packs := r.selectAllRepo()
sort.Sort(RepoByName(packs))
sort.Sort(RepoByPath(packs))
iterator := NewRepoIterator(packs)
return iterator
@ -77,11 +77,11 @@ func (all *Repos) Len() int {
return len(all.Repos)
}
type RepoByName []*Repo
type RepoByPath []*Repo
func (a RepoByName) Len() int { return len(a) }
func (a RepoByName) Less(i, j int) bool { return a[i].GoPath < a[j].GoPath }
func (a RepoByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a RepoByPath) Len() int { return len(a) }
func (a RepoByPath) Less(i, j int) bool { return a[i].GoPath < a[j].GoPath }
func (a RepoByPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
// safely returns a slice of pointers to the Repo protobufs
func (all *Repos) selectAllRepo() []*Repo {

View File

@ -3,7 +3,6 @@ package main
import (
"os"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@ -12,14 +11,6 @@ import (
var VERSION string
func main() {
var config forgepb.ForgeConfigs
if err := config.ConfigLoad(); err != nil {
log.Warn("forgepb.ConfigLoad() failed", err)
os.Exit(-1)
}
config.PrintTable()
var repos *gitpb.Repos
repos = new(gitpb.Repos)