summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--repo.protofiles.go11
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
}