(file: string, name: string, from?: { kind?: string; name?: string })
| 157 | * or named `from`) whose target is named `name`, deduplicated and sorted. |
| 158 | */ |
| 159 | const linksFrom = (file: string, name: string, from?: { kind?: string; name?: string }) => { |
| 160 | const sources = cg.getNodesInFile(file).filter((n) => (!from?.kind || n.kind === from.kind) && (!from?.name || n.name === from.name)); |
| 161 | const links = cg.getOutgoingEdgesFrom(sources.map((n) => n.id)) |
| 162 | .filter((e) => e.kind !== 'contains') |
| 163 | .map((e) => ({ kind: e.kind, target: cg.getNode(e.target)! })) |
| 164 | .filter(({ target }) => target.name === name) |
| 165 | .map(({ kind, target }) => `${kind} ${target.filePath}:${target.qualifiedName}`); |
| 166 | return [...new Set(links)].sort(); |
| 167 | }; |
| 168 | |
| 169 | describe('Go framework heuristics pick only in the package Go reads the name from', () => { |
| 170 | it('a bare type is its own package’s interface, not another package’s struct', () => { |
no test coverage detected