Skip to content

Commit

Permalink
Revert "Adding a golang flag to allow all non-required struct fields …
Browse files Browse the repository at this point in the history
…to be set to omitempty (#2449)"

This reverts commit 2a60269.
  • Loading branch information
dvdsgl committed Feb 13, 2024
1 parent 5c40a30 commit 8935d6e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/quicktype-core/src/language/Golang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8935d6e

Please sign in to comment.