summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/booktopipeline/main.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/booktopipeline/main.go b/cmd/booktopipeline/main.go
index 6e10475..a455966 100644
--- a/cmd/booktopipeline/main.go
+++ b/cmd/booktopipeline/main.go
@@ -118,7 +118,7 @@ func main() {
if err != nil {
log.Fatalln("Open file", path, "failed:", err)
}
- defer file.Close()
+ //defer file.Close() // done explicitly below
_, err = uploader.Upload(&s3manager.UploadInput{
Bucket: aws.String("rescribeinprogress"),
Key: aws.String(filepath.Join(bookname, name)),
@@ -130,7 +130,10 @@ func main() {
// Explicitly close here rather than wait for the defer, so we
// don't end up with too many open files which can cause os.Open
// to fail.
- file.Close()
+ err = file.Close()
+ if err != nil {
+ log.Fatalln("Failed to close file", path, err)
+ }
}
verboselog.Println("Sending message", bookname, "to queue", qurl)