Initial commit

This commit is contained in:
Alex Eidt 2021-11-22 19:14:37 -08:00
commit 059f46f9ed
10 changed files with 511 additions and 0 deletions

19
utils.go Normal file
View file

@ -0,0 +1,19 @@
package main
import (
"errors"
"os"
)
// Returns true if file exists, false otherwise.
// https://stackoverflow.com/questions/12518876/how-to-check-if-a-file-exists-in-go
func Exists(filename string) bool {
_, err := os.Stat(filename)
if err == nil {
return true
}
if errors.Is(err, os.ErrNotExist) {
return false
}
return false
}