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

Function pushGoJSONRequiredRawPathLines

scripts/codegen/go.ts:1568–1586  ·  view source on GitHub ↗
(
    lines: string[],
    rootRawExpr: string,
    path: string[],
    indent: string,
    varPrefix: string
)

Source from the content-addressed store, hash-verified

1566}
1567
1568function pushGoJSONRequiredRawPathLines(
1569 lines: string[],
1570 rootRawExpr: string,
1571 path: string[],
1572 indent: string,
1573 varPrefix: string
1574): string {
1575 let rawExpr = rootRawExpr;
1576 for (let index = 0; index < path.length; index++) {
1577 const structVar = goJSONPathVarName(varPrefix, path.slice(0, index));
1578 const fieldNames = pushGoJSONRawStructUnmarshalLines(lines, rawExpr, structVar, [path[index]], indent);
1579 const fieldExpr = `${structVar}.${fieldNames.get(path[index])!}`;
1580 lines.push(`${indent}if ${fieldExpr} == nil {`);
1581 lines.push(`${indent}\treturn false`);
1582 lines.push(`${indent}}`);
1583 rawExpr = fieldExpr;
1584 }
1585 return rawExpr;
1586}
1587
1588function pushGoJSONOptionalRawPathLines(
1589 lines: string[],

Callers 1

Calls 4

goJSONPathVarNameFunction · 0.85
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…