summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-06 19:23:05 -0600
committerJeff Carr <[email protected]>2024-11-06 19:23:05 -0600
commit44ab5deb3fe859ac09c91f2b06fc20a4710b142f (patch)
tree9a700f73c19b583074ed156e50bd324cb92dce1f
parent31355467a58e87673f959dbfed933ad02fba0733 (diff)
more work on protobuf files
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--common.go11
-rw-r--r--unix.go9
2 files changed, 15 insertions, 5 deletions
diff --git a/common.go b/common.go
index 8b88913..520d12b 100644
--- a/common.go
+++ b/common.go
@@ -59,13 +59,18 @@ func (rs *RepoStatus) IsPrimitive() bool {
return false
}
-func (rs *RepoStatus) IsProtobuf() (bool, []string, error) {
+func (rs *RepoStatus) IsProtobuf() (bool, []string, []string, error) {
log.Info("are there .proto files in:", rs.Path())
- all, err := ScanForProtobuf(rs.Path())
+ all, compiled, err := ScanForProtobuf(rs.Path())
+ var found bool = false
for i, s := range all {
log.Info("found i, s:", i, s)
+ found = true
}
- return false, all, err
+ for i, s := range compiled {
+ log.Info("found compiled i, s:", i, s)
+ }
+ return found, all, compiled, err
}
// returns the filesystem path to the repo
diff --git a/unix.go b/unix.go
index d4d48de..19872a6 100644
--- a/unix.go
+++ b/unix.go
@@ -471,8 +471,9 @@ func ScanGitDirectories(srcDir string) []string {
return all
}
-func ScanForProtobuf(srcDir string) ([]string, error) {
+func ScanForProtobuf(srcDir string) ([]string, []string, error) {
var protofiles []string
+ var compiled []string
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
log.Log(REPOWARN, "Error accessing path:", path, err)
@@ -484,8 +485,12 @@ func ScanForProtobuf(srcDir string) ([]string, error) {
protofiles = append(protofiles, path)
}
+ if strings.HasSuffix(path, ".pb.go") {
+ compiled = append(compiled, path)
+ }
+
return nil
})
- return protofiles, err
+ return protofiles, compiled, err
}