for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package utils
import (
"errors"
"os"
)
func FileExists(filePath string) (bool, error) {
_, err := os.Stat(filePath)
if err == nil {
return true, nil
}
if errors.Is(err, os.ErrNotExist) {
return false, nil
return false, err