err.go 246 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package util

import (
	"os"
	"syscall"
)

//no such file or directory
func IsNoSuchFileOrDirectory(err error) bool {
	if err == syscall.ENOENT {
		return true
	}
	pathErr, ok := err.(*os.PathError)
	return ok && pathErr.Err == syscall.ENOENT
}