Created
October 29, 2017 09:04
-
-
Save tkmru/1d9648f701e6e0301ca2887f46b83e69 to your computer and use it in GitHub Desktop.
file exist check
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
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