Skip to content

Commit

Permalink
Minor: fix error message when no files are found for local source (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
DuffleOne authored Jun 24, 2024
1 parent 4c17295 commit deabe1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/source_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package source
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"

kitlog "github.com/go-kit/kit/log"
Expand Down Expand Up @@ -35,10 +35,14 @@ func (s SourceLocal) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceE
return nil, errors.Wrap(err, "glob matching files")
}

if len(matches) == 0 {
return nil, errors.Errorf("no files found matching pattern: %s", pattern)
}

for _, match := range matches {
_, ok := results[match]
if !ok {
data, err := ioutil.ReadFile(match)
data, err := os.ReadFile(match)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("reading file: %s", match))
}
Expand Down

0 comments on commit deabe1a

Please sign in to comment.