Go: methods with the same name on different receiver types in one package collapse into one node
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 56/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- go
- Domínio
- backend-api-design, devtools
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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).
- Linguagem predominante
- C
- Estrelas
- 45.8k
- Forks
- 3.8k
- Merge médio
- 2d 18h
- PRs com merge (30d)
- 108
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de DeusData/codebase-memory-mcp
-
bug ux/behavior
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
DeusData/codebase-memory-mcp#3191 ·
Mantenedores costumam responder em até 1 dia
-
documentation enhancement parsing/quality ux/behavior
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 82/100
DeusData/codebase-memory-mcp#3131 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertabug editor/integration parsing/quality ux/behavior
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
DeusData/codebase-memory-mcp#3062 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Generated client files (AGENTS.md block, SKILL.md) teach a call syntax no harness can executeAbertabug documentation editor/integration parsing/quality
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
DeusData/codebase-memory-mcp#3050 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
editor/integration parsing/quality
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
DeusData/codebase-memory-mcp#2286 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de DeusData/codebase-memory-mcp
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
Mantenedores costumam responder em até 1 dia
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameAbertagame: 010065A014024000 ios
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
seedds/nxnative#3714 · 1 comentário ·
Mantenedores costumam responder em até 2 dias