Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
  • Loading branch information
beeme1mr committed Jan 17, 2025
1 parent 6ea340c commit 247b1ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 8 additions & 5 deletions core/pkg/sync/blob/blob_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
)

type Sync struct {
Bucket string
Object string
Bucket string
Object string
// FileType indicates the file type e.g., json, yaml/yml etc.,
fileType string
fileType string
BlobURLMux *blob.URLMux
Cron Cron
Logger *logger.Logger
Expand Down Expand Up @@ -142,7 +142,11 @@ func (hs *Sync) fetchObject(ctx context.Context, bucket *blob.Bucket) (string, e

switch hs.fileType {
case "yaml", "yml":
return utils.YAMLToJSON(buf.Bytes())
str, err := utils.YAMLToJSON(buf.Bytes())
if err != nil {
return "", fmt.Errorf("error converting blob from yaml to json: %w", err)
}
return str, nil
case "json":
return buf.String(), nil
default:
Expand All @@ -151,4 +155,3 @@ func (hs *Sync) fetchObject(ctx context.Context, bucket *blob.Bucket) (string, e
// return "", fmt.Errorf("filepath extension for URI: '%s' is not supported", hs.sync())
}
}

6 changes: 5 additions & 1 deletion core/pkg/sync/file/filepath_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ func (fs *Sync) fetch(_ context.Context) (string, error) {

switch fs.fileType {
case "yaml", "yml":
return utils.YAMLToJSON(rawFile)
str, err := utils.YAMLToJSON(rawFile)
if err != nil {
return "", fmt.Errorf("error converting file from yaml to json: %w", err)
}
return str, nil
case "json":
return string(rawFile), nil
default:
Expand Down

0 comments on commit 247b1ab

Please sign in to comment.