MCPcopy Index your code
hub / github.com/github/copilot-sdk / collectHandWrittenGoPublicNames

Function collectHandWrittenGoPublicNames

scripts/codegen/go.ts:3640–3660  ·  view source on GitHub ↗

* Scan hand-written `.go` files under `go/` and return every top-level exported * type or const name they declare. We use this to exclude those names from the * session-events alias file: when a schema-shared definition (e.g. `ContextTier`) * collides with a hand-written declaration of the same n

()

Source from the content-addressed store, hash-verified

3638 * test-only declaration would also collide with an alias of the same name.
3639 */
3640async function collectHandWrittenGoPublicNames(): Promise<Set<string>> {
3641 const goDir = path.join(REPO_ROOT, "go");
3642 const names = new Set<string>();
3643 let entries: string[];
3644 try {
3645 entries = await fs.readdir(goDir);
3646 } catch {
3647 return names;
3648 }
3649 for (const entry of entries) {
3650 if (!entry.endsWith(".go")) continue;
3651 if (entry.startsWith("z")) continue;
3652 const filePath = path.join(goDir, entry);
3653 const stat = await fs.stat(filePath);
3654 if (!stat.isFile()) continue;
3655 const content = await fs.readFile(filePath, "utf-8");
3656 for (const name of collectGoTopLevelNames(content, "type")) names.add(name);
3657 for (const name of collectGoTopLevelNames(content, "const")) names.add(name);
3658 }
3659 return names;
3660}
3661
3662function assertNoGoRpcSessionEventConflicts(rpcGeneratedTypeCode: string): void {
3663 const duplicateTypes = collectGoTopLevelNames(rpcGeneratedTypeCode, "type")

Callers 1

generateSessionEventsFunction · 0.85

Calls 6

collectGoTopLevelNamesFunction · 0.85
joinMethod · 0.80
readdirMethod · 0.65
statMethod · 0.65
readFileMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…