# error: open /tmp/foo.txt: no such file or directory

- **ID:** `go/os-file-not-exist-create`
- **Domain:** go
- **Category:** io_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

尝试打开不存在的文件，但未使用创建标志。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   f, err := os.OpenFile("/tmp/foo.txt", os.O_RDWR|os.O_CREATE, 0644)
   ```
2. **** (90% success)
   ```
   先检查文件是否存在，再决定打开或创建。
   ```

## Dead Ends

- **** — 文件不存在，后续操作会失败。 (100% fail)
- **** — os.Create会截断现有文件，可能覆盖数据。 (60% fail)
