(goType: string, ctx: GoCodegenCtx)
| 1040 | } |
| 1041 | |
| 1042 | function 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 | |
| 1061 | function pushGoEncodingBlock(blockLines: string[], ctx: GoCodegenCtx): void { |
| 1062 | if (blockLines.length === 0) return; |
no test coverage detected
searching dependent graphs…