Skip to content

Go: external receiver calls resolve to unrelated local interface methods #1276

Description

@ignazio-ingenito

CodeGraph 1.4.1 on linux-x64 attributes calls on a concrete external receiver (database/sql.DB) to same-named methods declared by an unrelated local interface.

Minimal fixture:

type InternalStore interface {
    Exec(string, ...any) (sql.Result, error)
    QueryRow(string, ...any) *sql.Row
}

type Target struct { conn *sql.DB }

func (target *Target) Write() error {
    _, err := target.conn.Exec("insert")
    return err
}

func (target *Target) Read() *sql.Row {
    return target.conn.QueryRow("select")
}

After codegraph init, codegraph callees Write --json reports Exec at the InternalStore declaration, and codegraph callees Read --json reports QueryRow at the InternalStore declaration. Target neither imports an internal implementation nor declares that it implements InternalStore.

Expected: calls resolve to database/sql.DB when supported, or remain external/unlinked. They should not create an internal dependency on InternalStore.

Actual JSON excerpts:

{"name":"Exec","kind":"method","filePath":"flow/flow.go","startLine":7}
{"name":"QueryRow","kind":"method","filePath":"flow/flow.go","startLine":8}

The positive fixture chain StartImport -> loadManifest -> PersistLineage is resolved correctly, so the failure is specific to generic receiver-method precision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions