feat: Support config files with viper (#4558)

This commit is contained in:
Garrett Delfosse
2022-10-21 15:26:39 -04:00
committed by GitHub
parent 2c47cda3d1
commit c8e299c8f1
35 changed files with 920 additions and 1089 deletions

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