Go: methods with the same name on different receiver types in one package collapse into one node
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 56/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- go
研究方向
Start by tracing how Go methods are assigned qualified names during indexing, then inspect the graph query behavior in the minimal repro’s handler/handlers.go. Check how receiver types are represented and compare with the Rust collision fix in #495. Done when both Create methods appear as distinct nodes and route edges resolve to the correct implementation.
由索引模型根據 Issue 內容生成。
描述
Summary
In Go, methods with the same name on different receiver types in the same package collapse into a single Method node. The qualified name omits the receiver type (<pkg>.<Method>), so the second definition overwrites the first. Downstream edges (HANDLES, CALLS, trace_path) then point to the wrong implementation.
Minimal repro (v0.12.1, darwin-arm64)
go.mod
module example.com/repro
go 1.22
handler/handlers.go
package handler
type ReminderHandler struct{}
func (h *ReminderHandler) Create() string { return "reminder" }
type CampaignHandler struct{}
func (h *CampaignHandler) Create() string { return "campaign" }
codebase-memory-mcp cli index_repository '{"repo_path":"<repro>","name":"repro","mode":"full"}'
codebase-memory-mcp cli query_graph '{"project":"repro","query":"MATCH (m:Method) RETURN m.name, m.qualified_name, m.start_line"}'
Actual: one row — Create | repro.handler.Create | 9
Expected: two rows, e.g. repro.handler.ReminderHandler.Create (line 5) and repro.handler.CampaignHandler.Create (line 9).
Impact on a real codebase
This pattern is idiomatic Go (several handlers/DAOs in one package, each with Create/List/Get). Counting (package dir, method name) pairs with more than one receiver across three Gin services:
| service | methods | collapsed |
|---|---|---|
| A | 910 | 95 (10.4%) |
| B | 174 | 29 (16.7%) |
| C | 1618 | 372 (23.0%) |
Example consequence: the HANDLES edge for /api/v1/reminders/create resolves to CampaignHandler.Create, so "which function handles this route?" returns the wrong answer.
Suggestion
Include the receiver type name in Go method qualified names (<pkg>.<Recv>.<Method>), similar to how the Rust cfg collision was addressed in #495. Related: #1911 (Go build-tag twin files colliding on one QN), #2061 (Swift overloads collapsing).
- 主要語言
- C
- 星號
- 45.8k
- 分支
- 3.8k
- 平均合併
- 2 天 18 小時
- 30 天內合併 PR
- 108
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
DeusData/codebase-memory-mcp 的其他 Issue
-
bug ux/behavior
難度 2/5 1-3 小時 新手友好度 70/100
DeusData/codebase-memory-mcp#3191 ·
維護者通常 1 天內回覆
-
documentation enhancement parsing/quality ux/behavior
難度 1/5 1-3 小時 新手友好度 82/100
DeusData/codebase-memory-mcp#3131 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug editor/integration parsing/quality ux/behavior
難度 2/5 1-3 小時 新手友好度 75/100
DeusData/codebase-memory-mcp#3062 · 2 則留言 ·
維護者通常 1 天內回覆
-
bug documentation editor/integration parsing/quality
難度 2/5 1-3 小時 新手友好度 75/100
DeusData/codebase-memory-mcp#3050 · 1 則留言 ·
維護者通常 1 天內回覆
-
editor/integration parsing/quality
難度 2/5 1-3 小時 新手友好度 68/100
DeusData/codebase-memory-mcp#2286 ·
維護者通常 1 天內回覆
查看 DeusData/codebase-memory-mcp 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
維護者通常 1 天內回覆
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the game未關閉game: 010065A014024000 ios
難度 2/5 1-3 小時 新手友好度 76/100
seedds/nxnative#3714 · 1 則留言 ·
維護者通常 2 天內回覆