From 3e45924aa2876484a8a0e2470b79604699fa562d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 29 Nov 2024 23:27:40 -0600 Subject: [PATCH] publish every *.pb.go file --- repo.protofiles.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/repo.protofiles.go b/repo.protofiles.go index 81a4b6f..2fadc9c 100644 --- a/repo.protofiles.go +++ b/repo.protofiles.go @@ -21,13 +21,13 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) { protos := make(map[string]string) protoc := make(map[string]string) var anyfound bool = false - var allc []string for _, s := range fullp { filebase := filepath.Base(s) name := strings.TrimSuffix(filebase, ".proto") anyfound = true protos[name] = s } + // make sure every .proto file has a .pb.go file for pname, _ := range protos { var found bool = false for _, s := range fullc { @@ -36,7 +36,6 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) { protoc[cname] = s if cname == pname { found = true - allc = append(allc, cfilebase) } } if found { @@ -46,6 +45,14 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) { err = errors.New("compiled file " + pname + ".pb.go missing") } } + + // assume every .pb.go file is autogenerated + var allc []string + for _, testf := range fullc { + if strings.HasSuffix(testf, ".pb.go") { + allc = append(allc, testf) + } + } return anyfound, allc, err }