Skip to content

Commit 1fb8a53

Browse files
committed
fine tune comments and messages
1 parent 86974ff commit 1fb8a53

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

modules/options/base.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func walkAssetDir(root string, callback func(path, name string, d fs.DirEntry, e
8686
func mustLocalPathAbs(s string) string {
8787
abs, err := filepath.Abs(s)
8888
if err != nil {
89+
// This should never happen in a real system. If it happens, the user must have already been in trouble: the system is not able to resolve its own paths.
8990
log.Fatal("Unable to get absolute path for %q: %v", s, err)
9091
}
9192
return abs
@@ -106,7 +107,7 @@ func listLocalDirIfExist(baseDirs []string, subDir string, elems ...string) (fil
106107
for _, localPath := range joinLocalPaths(baseDirs, subDir, elems...) {
107108
isDir, err := util.IsDir(localPath)
108109
if err != nil {
109-
return nil, fmt.Errorf("unable to check if static directory %s is a directory. %w", localPath, err)
110+
return nil, fmt.Errorf("unable to check if path %q is a directory. %w", localPath, err)
110111
} else if !isDir {
111112
continue
112113
}

modules/util/path.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package util
55

66
import (
77
"errors"
8+
"fmt"
89
"net/url"
910
"os"
1011
"path"
@@ -82,7 +83,7 @@ func SafeFilePathAbs(elem ...string) string {
8283
}
8384
if !filepath.IsAbs(elems[0]) {
8485
// This shouldn't happen. If there is really necessary to pass in relative path, return the full path with filepath.Abs() instead
85-
panic("SafeFilePathAbs: result is not absolute, do not guess a relative path based on current working directory")
86+
panic(fmt.Sprintf("SafeFilePathAbs: %q (for path %v) is not absolute, do not guess a relative path based on current working directory", elems[0], elems))
8687
}
8788

8889
for i := 1; i < len(elem); i++ {

0 commit comments

Comments
 (0)