Files
codegraph/__tests__
Colby Mchenry 93f85d10ce fix(go): an explicitly named import owns its name over an unaliased import's last path element (#2660)
fix(go): an explicitly named import owns its name over an unaliased import's last path element

Go binds a name to one import per file. etcd's benchmark tool imports
"github.com/cheggaaa/pb/v3" (package pb) beside
v3 "go.etcd.io/etcd/client/v3", so `v3.Op` is clientv3's. The import
mappings also listed the unaliased import under its last path element,
`v3`, and the first one listed, the progress-bar library outside the
project, took every `v3.` qualifier: `op v3.Op`, `c *v3.Client` and
`[]v3.OpOption` linked to nothing.

extractGoImports no longer lists an unaliased import under a name another
import is explicitly given; it keeps the name goimports assumes for it
(`pb`), as before.

A/B on main 383c2cd9: etcd +8 edges (tools/benchmark and etcdctl), all to
client/v3's types; gin, prometheus and kubernetes unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:00:47 +00:00
..