final commits before release

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-05 05:58:54 -06:00
parent 8eb7501855
commit e6f883a9b5
3 changed files with 34 additions and 4 deletions

View File

@ -59,6 +59,15 @@ func (rs *RepoStatus) IsPrimitive() bool {
return false
}
func (rs *RepoStatus) IsProtobuf() (bool, []string, error) {
log.Info("are there .proto files in:", rs.Path())
all, err := ScanForProtobuf(rs.Path())
for i, s := range all {
log.Info("found i, s:", i, s)
}
return false, all, err
}
// returns the filesystem path to the repo
func (rs *RepoStatus) Path() string {
return rs.realPath.String()

View File

@ -26,8 +26,10 @@ type RepoStatus struct {
dirtyList string // the output from git status --porcelain
readOnly *gadgets.OneLiner
gitState *gadgets.OneLiner
primitive *gadgets.OneLiner
private *gadgets.OneLiner
primitive *gadgets.OneLiner // aka: doesn't have a go.sum file
private *gadgets.OneLiner // it's not possible to publish this to pkg.go.dev
protobuf *gadgets.OneLiner // is this repo a protobuf repo?
path *gadgets.OneLiner
goSrcPath *gadgets.OneLiner

19
unix.go
View File

@ -466,3 +466,22 @@ func ScanGitDirectories(srcDir string) []string {
return all
}
func ScanForProtobuf(srcDir string) ([]string, error) {
var protofiles []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)
return err
}
if strings.HasSuffix(path, ".proto") {
//
protofiles = append(protofiles, path)
}
return nil
})
return protofiles, err
}