# protoc-gen-go：错误：在文件 "user.proto" 和 "user_v2.proto" 中重复的符号 "pb.User"

- **ID:** `go/proto-duplicate-symbol`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

两个 .proto 文件声明了相同的完全限定消息名（相同 package + message）并被一起编译，导致生成的 Go 代码中符号冲突。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| protoc-gen-go 1.31+ | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Give each file a distinct proto package:
// user.proto
package pb.v1;
// user_v2.proto
package pb.v2;
   ```
2. **** (85% 成功率)
   ```
   Use buf to detect and lint duplicate symbols across the workspace:
buf lint
buf breaking --against '.git#branch=main'
   ```

## 无效尝试

- **** — The collision is on the protobuf fully-qualified name, not the Go package; protoc still errors. (90% 失败率)
- **** — At link time the generated Go files still declare identical Go types and the Go build fails. (85% 失败率)
