Skip to content

Commit

Permalink
removed redundent nil error checking in pkg/runfileconfig/run_file_co…
Browse files Browse the repository at this point in the history
…nfig_parser.go and added proper error handling while unmarshalling json in pkg/runfileconfig/standalone/publish.go

Signed-off-by: yash dhadve [email protected]
  • Loading branch information
Exar04 committed Sep 19, 2024
1 parent aa0436e commit 89fd0c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/runfileconfig/run_file_config_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ func (a *RunFileConfig) resolvePathToAbsAndValidate(baseDir string, paths ...*st
return err
}
absPath := utils.GetAbsPath(baseDir, *path)
if err != nil {
return err
}

*path = absPath
if err = utils.ValidateFilePath(*path); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/standalone/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (s *Standalone) Publish(publishAppID, pubsubName, topic string, payload []b

// Detect publishing with CloudEvents envelope.
var cloudEvent map[string]interface{}
if json.Unmarshal(payload, &cloudEvent); err == nil {
if err := json.Unmarshal(payload, &cloudEvent); err == nil {
_, hasID := cloudEvent["id"]
_, hasSource := cloudEvent["source"]
_, hasSpecVersion := cloudEvent["specversion"]
Expand Down

0 comments on commit 89fd0c7

Please sign in to comment.