diff options
| author | Jeff Carr <[email protected]> | 2024-11-29 23:27:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-29 23:27:40 -0600 |
| commit | 3e45924aa2876484a8a0e2470b79604699fa562d (patch) | |
| tree | c3150158334f91e167ab54b2df716307e7a4424a /repo.protofiles.go | |
| parent | e88341d808423e3d5a46f5ee586c783462445670 (diff) | |
publish every *.pb.go file
Diffstat (limited to 'repo.protofiles.go')
| -rw-r--r-- | repo.protofiles.go | 11 |
1 files 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 } |
