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

Function goGeneratedEncodingFileCode

scripts/codegen/go.ts:3030–3057  ·  view source on GitHub ↗
(schemaFileName: string, packageName: string, generatedEncodingCode: string, wrapComments = false)

Source from the content-addressed store, hash-verified

3028}
3029
3030function goGeneratedEncodingFileCode(schemaFileName: string, packageName: string, generatedEncodingCode: string, wrapComments = false): string {
3031 const lines: string[] = [];
3032 lines.push(...goDoNotEditHeader(schemaFileName));
3033 lines.push(``);
3034 lines.push(`package ${packageName}`);
3035 lines.push(``);
3036
3037 const imports = [`"encoding/json"`];
3038 if (generatedEncodingCode.includes("errors.")) {
3039 imports.push(`"errors"`);
3040 }
3041 if (generatedEncodingCode.includes("time.Time")) {
3042 imports.push(`"time"`);
3043 }
3044 if (packageName !== "rpc" && generatedEncodingCode.includes("rpc.")) {
3045 imports.push(`"github.com/github/copilot-sdk/go/rpc"`);
3046 }
3047 lines.push(`import (`);
3048 for (const imp of imports) {
3049 lines.push(`\t${imp}`);
3050 }
3051 lines.push(`)`);
3052 lines.push(``);
3053 lines.push(generatedEncodingCode);
3054
3055 const code = lines.join("\n");
3056 return wrapComments ? wrapGeneratedGoComments(code) : code;
3057}
3058
3059function generateGoRpcTypeCode(definitions: Record<string, JSONSchema7>, definitionCollections: DefinitionCollections): GoGeneratedTypeCode {
3060 const ctx: GoCodegenCtx = {

Callers 2

generateSessionEventsFunction · 0.85
generateRpcFunction · 0.85

Calls 4

goDoNotEditHeaderFunction · 0.85
wrapGeneratedGoCommentsFunction · 0.85
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…