Skip to content

Instantly share code, notes, and snippets.

@tkmru
Created October 29, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkmru/1d9648f701e6e0301ca2887f46b83e69 to your computer and use it in GitHub Desktop.
Save tkmru/1d9648f701e6e0301ca2887f46b83e69 to your computer and use it in GitHub Desktop.
file exist check
import (
"os"
"log"
)
func isExist(filename string) bool {
_, err := os.Stat(filename)
return err == nil
}
func main() {
if !isExist("./conf") {
log.Panic("Config file not found.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment