Commit 11fd2aa7 authored by Brian Tiger Chow's avatar Brian Tiger Chow

feat(util) FileExists

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent cf8fb87d
package util
import "os"
func FileExists(filename string) bool {
fi, err := os.Lstat(filename)
if fi != nil || (err != nil && !os.IsNotExist(err)) {
return true
}
return false
}
package util
import "testing"
func TestFileDoesNotExist(t *testing.T) {
t.Parallel()
if FileExists("i would be surprised to discover that this file exists") {
t.Fail()
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment