From 5a8bc9367e17e4e03be389a8896a93ed8d4c93c1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 19 Oct 2025 06:32:34 -0500 Subject: notes for later --- cleanGoSum.go | 4 ++-- iterByMode.go | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 iterByMode.go diff --git a/cleanGoSum.go b/cleanGoSum.go index aa23d8c..61f6036 100644 --- a/cleanGoSum.go +++ b/cleanGoSum.go @@ -140,8 +140,8 @@ func (f *Forge) TrimGoSum(check *gitpb.Repo) error { } // rewrite the go.sum file -// data, _ := os.ReadFile("go.sum") -// cobol.DumbTable(string(data)) + // data, _ := os.ReadFile("go.sum") + // cobol.DumbTable(string(data)) newfilename := filepath.Join(filepath.Join(check.FullPath, "go.sum")) newf, err := os.OpenFile(newfilename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) diff --git a/iterByMode.go b/iterByMode.go new file mode 100644 index 0000000..37866ec --- /dev/null +++ b/iterByMode.go @@ -0,0 +1,25 @@ +package forgepb + +import ( + "iter" + "strings" + + "go.wit.com/lib/protobuf/gitpb" +) + +func (f *Forge) IterByMode() iter.Seq[*gitpb.Repo] { + if f == nil { + panic("forge is not initialized") + } + repos := gitpb.NewRepos() + if f.Config.Mode == ForgeMode_NORMAL { + for r := range f.Repos.IterAll() { + if !strings.HasPrefix(r.Namespace, "go.wit.com") { + continue + } + repos.Append(r) + } + return repos.IterByNamespace() + } + return f.Repos.IterAll() +} -- cgit v1.2.3