more work on protobuf files

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-06 19:23:05 -06:00
parent 31355467a5
commit 44ab5deb3f
2 changed files with 15 additions and 5 deletions

View File

@ -59,13 +59,18 @@ func (rs *RepoStatus) IsPrimitive() bool {
return false 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()) 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 { for i, s := range all {
log.Info("found i, s:", i, s) 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 // returns the filesystem path to the repo

View File

@ -471,8 +471,9 @@ func ScanGitDirectories(srcDir string) []string {
return all return all
} }
func ScanForProtobuf(srcDir string) ([]string, error) { func ScanForProtobuf(srcDir string) ([]string, []string, error) {
var protofiles []string var protofiles []string
var compiled []string
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error { err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
log.Log(REPOWARN, "Error accessing path:", path, err) log.Log(REPOWARN, "Error accessing path:", path, err)
@ -484,8 +485,12 @@ func ScanForProtobuf(srcDir string) ([]string, error) {
protofiles = append(protofiles, path) protofiles = append(protofiles, path)
} }
if strings.HasSuffix(path, ".pb.go") {
compiled = append(compiled, path)
}
return nil return nil
}) })
return protofiles, err return protofiles, compiled, err
} }