Skip to content

Commit

Permalink
Merge pull request #9 from cloudfoundry/fix-g110
Browse files Browse the repository at this point in the history
Catch or explicitly ignore unhandled errors
  • Loading branch information
MarcPaquette authored Sep 16, 2024
2 parents 39e58d6 + 8cc6462 commit 7bf4f76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion filelock-demo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func mainWithError() error {
}
fmt.Fprintf(os.Stderr, "printing file contents to stdout:\n")

os.Stdout.Write(contents)
_, err = os.Stdout.Write(contents)
if err != nil {
return fmt.Errorf("write to stdout: %s", err)
}

fmt.Fprintf(os.Stderr, "\nEnter new file contents and then Enter + Ctrl+D (EOF) to release the lock\n")

Expand Down

0 comments on commit 7bf4f76

Please sign in to comment.