# go: 模块 github.com/foo/bar@latest: 未找到模块

- **ID:** `go/go-mod-tidy-module-not-found`
- **领域:** go
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

指定的模块版本在模块代理或仓库中不存在，通常由于拼写错误或版本未发布。

## 版本兼容性

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

## 解决方案

1. ```
   Verify the module path and version: run 'go list -m github.com/foo/bar@latest' to check if the module exists.
   ```
2. ```
   Use a specific version instead of @latest: 'go get github.com/foo/bar@v1.2.3' after confirming the version exists.
   ```
3. ```
   Clear module cache and retry: 'go clean -modcache' then 'go mod tidy'
   ```

## 无效尝试

- **** — The -e flag only continues despite errors, but the module still won't be found, leaving the build broken. (80% 失败率)
- **** — Does not resolve the missing module; go mod tidy will still fail. (60% 失败率)
- **** — If the module is not found locally or on the proxy, this will not help; it may even worsen the situation by disabling proxy entirely. (70% 失败率)
