From 02b9ed57b3e1cff11d4ac45c4078900e8ab9685e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 28 Nov 2024 08:54:47 -0600 Subject: [PATCH] climbing up hill --- Makefile | 1 + repos.sort.go | 14 +++++++------- scanGoSrc/main.go | 9 --------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index c9d0d88..7fb1b82 100644 --- a/Makefile +++ b/Makefile @@ -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.* diff --git a/repos.sort.go b/repos.sort.go index b4656e6..8bde45a 100644 --- a/repos.sort.go +++ b/repos.sort.go @@ -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 { diff --git a/scanGoSrc/main.go b/scanGoSrc/main.go index 460a2b5..f59ea77 100644 --- a/scanGoSrc/main.go +++ b/scanGoSrc/main.go @@ -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)