traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
7.02k stars 349 forks source link

fix(src): use `errors.Is(err, fs.ErrNotExist)` #1556

Closed laushunyu closed 1 year ago

laushunyu commented 1 year ago

I implemented fs.FS. When the file does not exist, xerrors.Wrap(fs.ErrNotExist, "") will be returned. However, os.IsNotExist cannot handle this situation. I found the following comment:

// IsNotExist returns a boolean indicating whether the error is known to
// report that a file or directory does not exist. It is satisfied by
// ErrNotExist as well as some syscall errors.
//
// This function predates errors.Is. It only supports errors returned by
// the os package. New code should use errors.Is(err, fs.ErrNotExist).

Therefore, we should use errors.Is(err, fs.ErrNotExist) instead.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

ldez commented 1 year ago

@laushunyu you have to use an email related to your GitHub account to create your commit. After that you will have to sign the CLA.

laushunyu commented 1 year ago

@laushunyu you have to use an email related to your GitHub account to create your commit. After that you will have to sign the CLA.

email corrected😇.