diff options
| -rw-r--r-- | patchsets.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/patchsets.go b/patchsets.go index 3dd7ba5..5638187 100644 --- a/patchsets.go +++ b/patchsets.go @@ -56,8 +56,22 @@ func listPatchsets(w http.ResponseWriter) { for _, entry := range entries { // Check if the entry is a file and matches the *.pb pattern if !entry.IsDir() && filepath.Ext(entry.Name()) == ".pb" { - fmt.Fprintln(w, entry.Name()) - fmt.Println(entry.Name()) + bytes, err := os.ReadFile(filepath.Join(dirname, entry.Name())) + if err != nil { + fmt.Fprintln(w, entry.Name(), err) + fmt.Println(entry.Name(), err) + continue + } + var p *forgepb.Patchs + p = new(forgepb.Patchs) + err = p.Unmarshal(bytes) + if err != nil { + fmt.Fprintln(w, entry.Name(), err) + fmt.Println(entry.Name(), err) + continue + } + fmt.Fprintln(w, entry.Name(), p.Name, p.Comment) + fmt.Println(entry.Name(), p.Name, p.Comment) } } } |
