Skip to content

Commit b46bf13

Browse files
authored
Log file name in errors from GetRunfile function. (#232)
1 parent d8d1e47 commit b46bf13

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

helm/private/helm_utils/helm_utils.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package helm_utils
22

33
import (
44
"bufio"
5+
"errors"
56
"fmt"
67
"log"
78
"os"
@@ -168,12 +169,12 @@ func GetRunfile(runfile_path string) string {
168169
// Use the runfiles library to locate files
169170
runfile, err := runfiles.Rlocation(runfile_path)
170171
if err != nil {
171-
log.Fatal("When reading file ", runfile_path, " got error ", err)
172+
log.Fatalf("When reading file %s, got error %v", runfile, err)
172173
}
173174

174175
// Check that the file actually exist
175-
if _, err := os.Stat(runfile); err != nil {
176-
log.Fatal("File found by runfile doesn't exist")
176+
if _, err := os.Stat(runfile); errors.Is(err, os.ErrNotExist) {
177+
log.Fatalf("File %s found by runfile doesn't exist", runfile)
177178
}
178179

179180
return runfile

0 commit comments

Comments
 (0)