Skip to content

Commit

Permalink
fix: fix an incorrect printf and add a missing error check (#408)
Browse files Browse the repository at this point in the history
* fix(verify): printf is used incorrectly

* fix(slack): did not check JSON marshaling errors
  • Loading branch information
favonia committed Nov 5, 2023
1 parent 52149dc commit f4e1c7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/services/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ func (service *Service) sendAPI(config *Config, payload interface{}) error {

func (service *Service) sendWebhook(config *Config, payload interface{}) error {
payloadBytes, err := json.Marshal(payload)
var res *http.Response
res, err = http.Post(config.Token.WebhookURL(), jsonclient.ContentType, bytes.NewBuffer(payloadBytes))

if err != nil {
return fmt.Errorf("failed to marshal payload: %w", err)
}
res, err := http.Post(config.Token.WebhookURL(), jsonclient.ContentType, bytes.NewBuffer(payloadBytes))
if err != nil {
return fmt.Errorf("failed to invoke webhook: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion shoutrrr/cmd/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ func Run(cmd *cobra.Command, _ []string) {
config := format.GetServiceConfig(service)
configNode := format.GetConfigFormat(config)

_, _ = fmt.Fprintf(color.Output, format.ColorFormatTree(configNode, true))
_, _ = fmt.Fprint(color.Output, format.ColorFormatTree(configNode, true))
}

0 comments on commit f4e1c7c

Please sign in to comment.