Revert "Revert "feat: Support config files with viper"" (#4693)

This commit is contained in:
Garrett Delfosse
2022-10-21 20:55:20 +00:00
committed by GitHub
parent d15b4159ef
commit 372fb1f345
35 changed files with 921 additions and 1089 deletions
+4
View File
@@ -441,6 +441,10 @@ func (g *Generator) buildStruct(obj types.Object, st *types.Struct) (string, err
jsonOptional bool
)
if err == nil {
if jsonTag.Name == "-" {
// Completely ignore this field.
continue
}
jsonName = jsonTag.Name
if len(jsonTag.Options) > 0 && jsonTag.Options[0] == "omitempty" {
jsonOptional = true