Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Parraga <[email protected]>
  • Loading branch information
Sovietaced committed Feb 28, 2025
1 parent 2291526 commit 3305736
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions flytestdlib/cli/pflags/api/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ func discoverFieldsRecursive(ctx context.Context, workingDirPkg string, typ inte

addField(typ, f)
case *types.Alias:
// For type aliases/named types (e.g. `type Foo int`), they will show up as Named but their underlying type
// will be basic.
// For alias types, they will show up as Alias but their underlying type will be basic.
if b, isBasic := t.Underlying().(*types.Basic); isBasic {
f, err := buildBasicField(ctx, tag, b, defaultValueAccessor, fieldPath, variable, false, false, isPtr, bindDefaultVar, nil)
if err != nil {
Expand Down Expand Up @@ -294,10 +293,10 @@ func discoverFieldsRecursive(ctx context.Context, workingDirPkg string, typ inte
testValue = `"1"`
}

Check warning on line 294 in flytestdlib/cli/pflags/api/generator.go

View check run for this annotation

Codecov / codecov/patch

flytestdlib/cli/pflags/api/generator.go#L292-L294

Added lines #L292 - L294 were not covered by tests

logger.Infof(ctx, "[%v] is of a Named type (struct) with default value [%v].", tag.Name, tag.DefaultValue)
logger.Infof(ctx, "[%v] is of an Alias type (struct) with default value [%v].", tag.Name, tag.DefaultValue)

if jsonUnmarshaler {
logger.Infof(logger.WithIndent(ctx, indent), "Type is json unmarhslalable.")
logger.Infof(logger.WithIndent(ctx, indent), "Type is json unmarshallable.")

addField(typ, FieldInfo{
Name: tag.Name,
Expand Down Expand Up @@ -341,8 +340,7 @@ func discoverFieldsRecursive(ctx context.Context, workingDirPkg string, typ inte
}

Check warning on line 340 in flytestdlib/cli/pflags/api/generator.go

View check run for this annotation

Codecov / codecov/patch

flytestdlib/cli/pflags/api/generator.go#L338-L340

Added lines #L338 - L340 were not covered by tests
}
case *types.Named:
// For type aliases/named types (e.g. `type Foo int`), they will show up as Named but their underlying type
// will be basic.
// For named types, they will show up as Named but their underlying type will be basic.
if _, isBasic := t.Underlying().(*types.Basic); isBasic {
logger.Debugf(ctx, "type [%v] is a named basic type. Using buildNamedBasicField to generate it.", t.Obj().Name())
f, err := buildNamedBasicField(ctx, workingDirPkg, tag, t, defaultValueAccessor, fieldPath, variable, isPtr, bindDefaultVar)
Expand Down Expand Up @@ -400,7 +398,7 @@ func discoverFieldsRecursive(ctx context.Context, workingDirPkg string, typ inte
logger.Infof(ctx, "[%v] is of a Named type (struct) with default value [%v].", tag.Name, tag.DefaultValue)

if jsonUnmarshaler {
logger.Infof(logger.WithIndent(ctx, indent), "Type is json unmarhslalable.")
logger.Infof(logger.WithIndent(ctx, indent), "Type is json unmarshallable.")

addField(typ, FieldInfo{
Name: tag.Name,
Expand Down

0 comments on commit 3305736

Please sign in to comment.