diff options
| -rw-r--r-- | cleanGoSum.go | 4 | ||||
| -rw-r--r-- | iterByMode.go | 25 |
2 files changed, 27 insertions, 2 deletions
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() +} |
