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

Function goDiscriminatedUnionField

scripts/codegen/go.ts:1042–1059  ·  view source on GitHub ↗
(goType: string, ctx: GoCodegenCtx)

Source from the content-addressed store, hash-verified

1040}
1041
1042function goDiscriminatedUnionField(goType: string, ctx: GoCodegenCtx): GoDiscriminatedUnionField | undefined {
1043 const single = goDiscriminatedUnionInfoForType(goType, ctx);
1044 if (single) return { kind: "single", unionInfo: single };
1045
1046 if (goTypeIsSlice(goType)) {
1047 const itemType = goType.slice(2);
1048 const item = goDiscriminatedUnionInfoForType(itemType, ctx);
1049 if (item) return { kind: "slice", unionInfo: item };
1050 }
1051
1052 const mapMatch = /^map\[string\](.+)$/.exec(goType);
1053 if (mapMatch) {
1054 const value = goDiscriminatedUnionInfoForType(mapMatch[1], ctx);
1055 if (value) return { kind: "map", unionInfo: value };
1056 }
1057
1058 return undefined;
1059}
1060
1061function pushGoEncodingBlock(blockLines: string[], ctx: GoCodegenCtx): void {
1062 if (blockLines.length === 0) return;

Callers 1

Calls 3

goTypeIsSliceFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…