From 8935d6e3acc808b6bac01db6f964ac04d99c88dc Mon Sep 17 00:00:00 2001 From: David Siegel Date: Mon, 12 Feb 2024 20:30:26 -0800 Subject: [PATCH] Revert "Adding a golang flag to allow all non-required struct fields to be set to omitempty (#2449)" This reverts commit 2a60269d431b392b658e671df2c1fb5479aec855. --- packages/quicktype-core/src/language/Golang.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/quicktype-core/src/language/Golang.ts b/packages/quicktype-core/src/language/Golang.ts index c7aa3110c..42cfacddd 100644 --- a/packages/quicktype-core/src/language/Golang.ts +++ b/packages/quicktype-core/src/language/Golang.ts @@ -25,8 +25,7 @@ export const goOptions = { justTypesAndPackage: new BooleanOption("just-types-and-package", "Plain types with package only", false), packageName: new StringOption("package", "Generated package name", "NAME", "main"), multiFileOutput: new BooleanOption("multi-file-output", "Renders each top-level object in its own Go file", false), - fieldTags: new StringOption("field-tags", "list of tags which should be generated for fields", "TAGS", "json"), - omitEmpty: new BooleanOption("omit-empty", "If set, all non-required objects will be tagged with ,omitempty", false) + fieldTags: new StringOption("field-tags", "list of tags which should be generated for fields", "TAGS", "json") }; export class GoTargetLanguage extends TargetLanguage { @@ -89,7 +88,6 @@ function isValueType(t: Type): boolean { function canOmitEmpty(cp: ClassProperty): boolean { if (!cp.isOptional) return false; - if (goOptions.omitEmpty) return true; const t = cp.type; return ["union", "null", "any"].indexOf(t.kind) < 0; }