Answers for "golang check if a path contains a valid directory"

0

golang check if a path contains a valid directory

dir, err := os.Stat(dirName)
if err != nil {
	return filesHash, fmt.Errorf("failed to open directory, error: %w", err)
}
if !dir.IsDir() {
	return filesHash, fmt.Errorf("%q is not a directory", dir.Name())
}
Posted by: Guest on October-21-2020

Code answers related to "golang check if a path contains a valid directory"

Browse Popular Code Answers by Language