util: More error handling
This commit is contained in:
@@ -29,6 +29,9 @@ import (
|
|||||||
// FsTree returns a string representation of the file system tree similar to the
|
// FsTree returns a string representation of the file system tree similar to the
|
||||||
// well-known `tree` command.
|
// well-known `tree` command.
|
||||||
func FsTree(fs afero.Fs, name string) (string, error) {
|
func FsTree(fs afero.Fs, name string) (string, error) {
|
||||||
|
if fs == nil {
|
||||||
|
return "", fmt.Errorf("nil fs")
|
||||||
|
}
|
||||||
clean := path.Clean(name)
|
clean := path.Clean(name)
|
||||||
str := clean + "/\n" // named dir
|
str := clean + "/\n" // named dir
|
||||||
if name == "" {
|
if name == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user