Passed
Push — master ( 4dcc72...1f1bc8 )
by Serhii
03:39 queued 01:59
created

utils/file_exists.go   A

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 11
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A utils.FileExists 0 12 3
1
package utils
2
3
import (
4
	"errors"
5
	"os"
6
)
7
8
func FileExists(filePath string) (bool, error) {
9
	_, err := os.Stat(filePath)
10
11
	if err == nil {
12
		return true, nil
13
	}
14
15
	if errors.Is(err, os.ErrNotExist) {
16
		return false, nil
17
	}
18
19
	return false, err
20
}
21