Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
text += `${comment(enm.language.go!.name, '// ')} - ${enm.language.go!.description}\n`;
}
text += `type ${enm.language.go!.name} ${enm.choiceType.language.go!.name}\n\n`;
enm.choices.sort((a: ChoiceValue, b: ChoiceValue) => { return SortAscending(a.language.go!.name, b.language.go!.name); });
const vals = new Array();
text += 'const (\n'
for (const val of values(enm.choices)) {
if (HasDescription(val.language.go!)) {
text += `\t${comment(val.language.go!.name, '// ')} - ${val.language.go!.description}\n`;
}
text += `\t${val.language.go!.name} ${enm.language.go!.name} = "${val.value}"\n`;
vals.push(val.language.go!.name);
}
text += ")\n\n"
text += `func ${enm.language.go!.possibleValuesFunc}() []${enm.language.go!.name} {\n`;
text += `\treturn []${enm.language.go!.name}{${joinComma(vals, (item: string) => item)}}\n`;
text += '}\n\n';
}
return text;
}