Skip to content

Commit

Permalink
Merge pull request #3 from inngest/chore/fmt
Browse files Browse the repository at this point in the history
Use `fmt.Fprintf` instead of writing to stdout directly
  • Loading branch information
tonyhb committed Jul 16, 2021
2 parents 0b26c1e + 3f47615 commit 3563436
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions actionsdk/actionsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func WriteError(err error) {
log.Fatal(fmt.Errorf("unable to marshal error: %w", err))
}

_, err = os.Stderr.Write(byt)
_, err = fmt.Fprint(os.Stdout, string(byt))
if err != nil {
log.Fatal(fmt.Errorf("unable to write error: %w", err))
}
Expand All @@ -42,15 +42,15 @@ func WriteError(err error) {
// of this SDK, and writing more than once may produce an error in the future.
func WriteResult(i interface{}) error {
if i == nil {
_, err := os.Stdout.Write([]byte("{}"))
_, err := fmt.Fprint(os.Stdout, "{}")
return err
}

byt, err := json.Marshal(i)
if err != nil {
return fmt.Errorf("error writing output: %w", err)
}
_, err = os.Stdout.Write(byt)
_, err = fmt.Fprint(os.Stdout, string(byt))
return err
}

Expand Down

0 comments on commit 3563436

Please sign in to comment.