Initial commit
This commit is contained in:
commit
059f46f9ed
10 changed files with 511 additions and 0 deletions
19
utils.go
Normal file
19
utils.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue