diff --git a/crypto.go b/crypto.go index ea65d92..bbf05fc 100644 --- a/crypto.go +++ b/crypto.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" "io" + "log" "math/big" mathrand "math/rand" "os" @@ -141,7 +142,11 @@ func Encrypt(c *Conf, filename string) error { if err != nil { return err } - defer outfile.Close() + defer func() { + if err := outfile.Close(); err != nil { + log.Fatal(err) + } + }() key, err := GetRandomKey() if err != nil {