publish every *.pb.go file

This commit is contained in:
Jeff Carr 2024-11-29 23:27:40 -06:00
parent e88341d808
commit 3e45924aa2
1 changed files with 9 additions and 2 deletions

View File

@ -21,13 +21,13 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) {
protos := make(map[string]string) protos := make(map[string]string)
protoc := make(map[string]string) protoc := make(map[string]string)
var anyfound bool = false var anyfound bool = false
var allc []string
for _, s := range fullp { for _, s := range fullp {
filebase := filepath.Base(s) filebase := filepath.Base(s)
name := strings.TrimSuffix(filebase, ".proto") name := strings.TrimSuffix(filebase, ".proto")
anyfound = true anyfound = true
protos[name] = s protos[name] = s
} }
// make sure every .proto file has a .pb.go file
for pname, _ := range protos { for pname, _ := range protos {
var found bool = false var found bool = false
for _, s := range fullc { for _, s := range fullc {
@ -36,7 +36,6 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) {
protoc[cname] = s protoc[cname] = s
if cname == pname { if cname == pname {
found = true found = true
allc = append(allc, cfilebase)
} }
} }
if found { if found {
@ -46,6 +45,14 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) {
err = errors.New("compiled file " + pname + ".pb.go missing") 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 return anyfound, allc, err
} }