Skip to content

Commit

Permalink
perf: cheap first
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Jun 19, 2024
1 parent 34aeedc commit 205b4b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion env.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func doParseField(refField reflect.Value, refTypeField reflect.StructField, proc
return err
}

if isStructPtr(refField) && refField.IsNil() && params.Init {
if params.Init && isStructPtr(refField) && refField.IsNil() {
refField.Set(reflect.New(refField.Type().Elem()))
refField = refField.Elem()

Expand Down

0 comments on commit 205b4b0

Please sign in to comment.