@@ -70,7 +70,10 @@ func (s *sicher) Initialize(scanReader io.Reader) error {
7070 }
7171 defer keyFile .Close ()
7272
73- keyFileStats , _ := keyFile .Stat ()
73+ keyFileStats , err := keyFile .Stat ()
74+ if err != nil {
75+ return fmt .Errorf ("error getting key file stats: %s" , err )
76+ }
7477
7578 // create the encrypted credentials file if it doesn't exist
7679 encFile , err := os .OpenFile (fmt .Sprintf ("%s%s.enc" , s .Path , s .Environment ), os .O_APPEND | os .O_CREATE | os .O_RDWR , 0600 )
@@ -79,7 +82,10 @@ func (s *sicher) Initialize(scanReader io.Reader) error {
7982 }
8083 defer encFile .Close ()
8184
82- encFileStats , _ := encFile .Stat ()
85+ encFileStats , err := encFile .Stat ()
86+ if err != nil {
87+ return fmt .Errorf ("error getting key file stats: %s" , err )
88+ }
8389
8490 // if keyfile is new
8591 // Absence of keyfile indicates that the project is new or keyfile is lost
@@ -114,7 +120,10 @@ func (s *sicher) Initialize(scanReader io.Reader) error {
114120 }
115121
116122 // stats will have changed if the file was truncated
117- encFileStats , _ = encFile .Stat ()
123+ encFileStats , err = encFile .Stat ()
124+ if err != nil {
125+ return fmt .Errorf ("error getting key file stats: %s" , err )
126+ }
118127
119128 // if the encrypted file is new, write some random data to it
120129 if encFileStats .Size () < 1 {
0 commit comments