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 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 // returns the filesystem path to the repo
func (rs *RepoStatus) Path() string { func (rs *RepoStatus) Path() string {
return rs.realPath.String() return rs.realPath.String()

View File

@ -10,7 +10,7 @@ type RepoStatus struct {
changed bool // keeps track of changes that might have happened changed bool // keeps track of changes that might have happened
changes string changes string
tags map[string]string tags map[string]string
InitOk bool // it takes a second or so to init these InitOk bool // it takes a second or so to init these
// used to temporarily tell the automation tools to // used to temporarily tell the automation tools to
// try to ignore this repo's changes and state // try to ignore this repo's changes and state
@ -23,11 +23,13 @@ type RepoStatus struct {
Tags *GitTagBox // a box of all the git tags Tags *GitTagBox // a box of all the git tags
dirtyLabel *gadgets.OneLiner dirtyLabel *gadgets.OneLiner
dirtyList string // the output from git status --porcelain dirtyList string // the output from git status --porcelain
readOnly *gadgets.OneLiner readOnly *gadgets.OneLiner
gitState *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 path *gadgets.OneLiner
goSrcPath *gadgets.OneLiner goSrcPath *gadgets.OneLiner

19
unix.go
View File

@ -466,3 +466,22 @@ func ScanGitDirectories(srcDir string) []string {
return all 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
}