Skip to content

Commit

Permalink
doc: advise defer Close() on the objectReader
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Nov 12, 2022
1 parent ff48c35 commit 3926776
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,15 @@ if err != nil {
fmt.Println(err)
return
}
defer object.Close()

localFile, err := os.Create("/tmp/local-file.jpg")
if err != nil {
fmt.Println(err)
return
}
defer localFile.Close()

if _, err = io.Copy(localFile, object); err != nil {
fmt.Println(err)
return
Expand Down

0 comments on commit 3926776

Please sign in to comment.