err 是用 fmt.Errorf("read config: %w", os.ErrNotExist) 包装的错误,判断其是否为「文件不存在」应使用?

Go

  1. A.errors.Is(err, os.ErrNotExist)
  2. B.err == os.ErrNotExist
  3. C.strings.Contains(err.Error(), "not exist")
  4. D.err.(*os.PathError)