Skip to content

Instantly share code, notes, and snippets.

@bcarlin
Last active December 18, 2015 22:49
Show Gist options
  • Save bcarlin/5857571 to your computer and use it in GitHub Desktop.
Save bcarlin/5857571 to your computer and use it in GitHub Desktop.
Misc file utilities for golang code (aka functions I will not remenber but I want to find easily
// equivalent to Python's `if not os.path.exists(path)`
func FileExists(path string) bool {
_, err := os.Stat(path)
if os.IsNotExist(err) {
return false
} else {
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment