Created
January 12, 2021 07:14
-
-
Save aramboyajyan/0f649fbac7130107332cfdced23816e4 to your computer and use it in GitHub Desktop.
Golang check if target directory exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func DirExists(path string) (bool, error) { | |
_, err := os.Stat(path) | |
if err == nil { | |
return true, nil | |
} else if os.IsNotExist(err) { | |
return false, nil | |
} | |
return false, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment