Skip to content

Instantly share code, notes, and snippets.

@toashd
Created January 29, 2015 11:07
Show Gist options
  • Select an option

  • Save toashd/ee105034c763a65c5534 to your computer and use it in GitHub Desktop.

Select an option

Save toashd/ee105034c763a65c5534 to your computer and use it in GitHub Desktop.
Go check if file exists
// Exists reports whether the named file or directory exists.
func Exists(name string) bool {
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment