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

Function pushGoJSONStringMatchLines

scripts/codegen/go.ts:1251–1268  ·  view source on GitHub ↗
(
    lines: string[],
    rawExpr: string,
    values: string[],
    indent: string,
    varPrefix: string
)

Source from the content-addressed store, hash-verified

1249}
1250
1251function pushGoJSONStringMatchLines(
1252 lines: string[],
1253 rawExpr: string,
1254 values: string[],
1255 indent: string,
1256 varPrefix: string
1257): void {
1258 const stringVar = `${varPrefix}String`;
1259 lines.push(`${indent}var ${stringVar} string`);
1260 lines.push(`${indent}if err := json.Unmarshal(${rawExpr}, &${stringVar}); err != nil {`);
1261 lines.push(`${indent}\treturn false`);
1262 lines.push(`${indent}}`);
1263 lines.push(`${indent}switch ${stringVar} {`);
1264 lines.push(`${indent}case ${[...new Set(values)].sort().map((value) => JSON.stringify(value)).join(", ")}:`);
1265 lines.push(`${indent}default:`);
1266 lines.push(`${indent}\treturn false`);
1267 lines.push(`${indent}}`);
1268}
1269
1270function pushGoJSONObjectMatchLines(
1271 lines: string[],

Callers 2

Calls 2

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…