MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / resolveInOwnPackage

Function resolveInOwnPackage

src/resolution/frameworks/go.ts:197–201  ·  view source on GitHub ↗

* A framework name heuristic's pick (see name-heuristic.ts) among the * declarations of the reference's own package — its directory — its own * file's first. No folder convention applies: Go never reads a bare name from * another package, a dot import aside.

(ref: UnresolvedRef, kinds: ReadonlySet<string>, context: ResolutionContext)

Source from the content-addressed store, hash-verified

195 * another package, a dot import aside.
196 */
197function resolveInOwnPackage(ref: UnresolvedRef, kinds: ReadonlySet<string>, context: ResolutionContext): string | null {
198 const dir = ref.filePath.slice(0, ref.filePath.lastIndexOf('/') + 1);
199 const inPackage = (n: Node) => n.filePath.startsWith(dir) && !n.filePath.slice(dir.length).includes('/');
200 return pickByNameAndKind(ref, kinds, () => false, context, { accept: inPackage });
201}

Callers 1

resolveFunction · 0.85

Calls 1

pickByNameAndKindFunction · 0.90

Tested by

no test coverage detected