# go: /path/to/dir 中没有可构建的 Go 源文件

- **ID:** `go/go-build-no-buildable-go-source`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

指定的 go build 目录中没有 .go 文件，或所有 .go 文件都包含排除当前平台的构建约束。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |

## 解决方案

1. **** (80% 成功率)
   ```
   Check for build tags: 'go build -tags=yourtag' if files have constraints.
   ```
2. **** (90% 成功率)
   ```
   Ensure the directory contains at least one .go file with a package statement; if not, move files or adjust the build command.
   ```

## 无效尝试

- **** — If the package name does not match the directory or has no exports, it may still fail to build. (40% 失败率)
- **** — Renaming directories can break imports and module paths. (60% 失败率)
