diff --git a/packages/quicktype-core/src/language/Golang/GolangRenderer.ts b/packages/quicktype-core/src/language/Golang/GolangRenderer.ts index 708666452..fc424f12f 100644 --- a/packages/quicktype-core/src/language/Golang/GolangRenderer.ts +++ b/packages/quicktype-core/src/language/Golang/GolangRenderer.ts @@ -237,7 +237,7 @@ export class GoRenderer extends ConvenienceRenderer { let columns: Sourcelike[][] = []; this.forEachEnumCase(e, "none", (name, jsonName) => { columns.push([ - [name, " "], + this._options.enumTypeNameSuffix ? [name, enumName, " "] : [name, " "], [enumName, ' = "', stringEscape(jsonName), '"'] ]); }); diff --git a/packages/quicktype-core/src/language/Golang/language.ts b/packages/quicktype-core/src/language/Golang/language.ts index f38edff15..1faaab881 100644 --- a/packages/quicktype-core/src/language/Golang/language.ts +++ b/packages/quicktype-core/src/language/Golang/language.ts @@ -17,7 +17,8 @@ export const goOptions = { "omit-empty", 'If set, all non-required objects will be tagged with ",omitempty"', false - ) + ), + enumTypeNameSuffix: new BooleanOption("enum-type-name-suffix", "Appends the type name to enum contracts", false) }; export class GoTargetLanguage extends TargetLanguage { @@ -32,7 +33,8 @@ export class GoTargetLanguage extends TargetLanguage { goOptions.packageName, goOptions.multiFileOutput, goOptions.fieldTags, - goOptions.omitEmpty + goOptions.omitEmpty, + goOptions.enumTypeNameSuffix ]; }