From 44ab5deb3fe859ac09c91f2b06fc20a4710b142f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 6 Nov 2024 19:23:05 -0600 Subject: [PATCH] more work on protobuf files Signed-off-by: Jeff Carr --- common.go | 11 ++++++++--- unix.go | 9 +++++++-- 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 }