# 打开 /path/to/file: 没有这样的文件或目录

- **ID:** `go/os-open-no-such-file`
- **领域:** go
- **类别:** io_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

尝试打开不存在的文件，通常是由于路径拼写错误或文件已被删除。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.13 | active | — | — |
| 1.14 | active | — | — |
| 1.15 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Use os.OpenFile with O_RDONLY and check the error.
   ```
2. **** (85% 成功率)
   ```
   Use filepath.Abs to resolve the path and verify it.
   ```

## 无效尝试

- **** — There is a race condition between the check and the open. (50% 失败率)
- **** — This creates an empty file, which may not be desirable. (60% 失败率)
