Skip to content

Commit

Permalink
updated ShouldSkipFile
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed May 26, 2024
1 parent 14306d5 commit ef44918
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/pkgio/dir_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *DirReader) getPaths(ctx context.Context) ([]string, error) {
return nil
}
// process glob
if match, err := r.MatchFilesGlob.shouldSkipFile(path); err != nil {
if match, err := r.MatchFilesGlob.ShouldSkipFile(path); err != nil {
return err
} else if match {
// skip the file
Expand All @@ -119,7 +119,7 @@ func (r *DirReader) getPaths(ctx context.Context) ([]string, error) {

type MatchFilesGlob []string

func (m MatchFilesGlob) shouldSkipFile(path string) (bool, error) {
func (m MatchFilesGlob) ShouldSkipFile(path string) (bool, error) {
for _, g := range m {
g := g
if match, err := filepath.Match(g, filepath.Base(path)); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/pkgio/kform_file_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type KformFileReader struct {
}

func (r *KformFileReader) Read(ctx context.Context) (store.Storer[*yaml.RNode], error) {
if match, err := MatchFilesGlob(YAMLMatch).shouldSkipFile(r.Path); err != nil {
if match, err := MatchFilesGlob(YAMLMatch).ShouldSkipFile(r.Path); err != nil {
return nil, fmt.Errorf("not a yaml file, err: %s", err.Error())
} else if match {
return nil, fmt.Errorf("not a yaml file")
Expand Down
4 changes: 2 additions & 2 deletions pkg/pkgio/kform_mem_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (r *KformMemReader) Read(ctx context.Context) (store.Storer[*yaml.RNode], e
if r.Data != nil {
r.Data.List(ctx, func(ctx context.Context, k store.Key, b []byte) {
// only look at yaml files
if match, err := MatchFilesGlob(YAMLMatch).shouldSkipFile(k.Name); err != nil {
if match, err := MatchFilesGlob(YAMLMatch).ShouldSkipFile(k.Name); err != nil {
errors.Join(errm, err)
return
} else if match {
Expand All @@ -74,7 +74,7 @@ func (r *KformMemReader) Read(ctx context.Context) (store.Storer[*yaml.RNode], e
data := data
path := path
// only look at yaml files
if match, err := MatchFilesGlob(YAMLMatch).shouldSkipFile(path); err != nil {
if match, err := MatchFilesGlob(YAMLMatch).ShouldSkipFile(path); err != nil {
errors.Join(errm, err)
continue
} else if match {
Expand Down

0 comments on commit ef44918

Please sign in to comment.