Skip to content

Commit 2be7f7b

Browse files
committed
refactor(backstage): simplify condition checks in List function
Remove redundant nil checks for options.Fields and options.Order slices. The len() function already returns 0 for nil slices, making the additional nil check unnecessary.
1 parent e84c014 commit 2be7f7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backstage/entity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ func (s *entityService) List(ctx context.Context, options *ListEntityOptions) ([
216216
values.Add("filter", f)
217217
}
218218

219-
if options.Fields != nil && len(options.Fields) > 0 {
219+
if len(options.Fields) > 0 {
220220
values.Add("fields", strings.Join(options.Fields, ","))
221221
}
222222

223-
if options.Order != nil && len(options.Order) > 0 {
223+
if len(options.Order) > 0 {
224224
for _, o := range options.Order {
225225
if order, err := o.string(); err != nil {
226226
return nil, nil, err

0 commit comments

Comments
 (0)