1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Don't swallow potential errors from os.Stat.

This commit is contained in:
Jimmy Cuadra
2020-07-28 03:32:22 -07:00
parent d9b196c87c
commit 5c171c800c

View File

@@ -92,12 +92,12 @@ func (key *MasterKey) Decrypt() ([]byte, error) {
_, err := os.Stat(path)
if os.IsNotExist(err) {
return nil, fmt.Errorf("no private key found at %s", path)
}
file, err := os.Open(path)
if err != nil {
return nil, fmt.Errorf("no private key found at %s: %s", path, err)
}
defer file.Close()
scanner := bufio.NewScanner(file)