Empty slice literal of type "[]App" used to define "apps"
25
26func (client *Client) GetAppsForOrganization(ctx context.Context, orgID string) ([]App, error) {
27 more := true
28 apps := []App{} 29 var cursor string
30
31 for more {
Empty slice literal of type "[]App" used to define "apps"
6
7func (client *Client) GetApps(ctx context.Context, role *string) ([]App, error) {
8 more := true
9 apps := []App{} 10 var cursor string
11
12 for more {
Description
An empty slice can be represented by nil
or an empty slice literal. They are
functionally equivalent — their len
and cap
are both zero — but the nil
slice is the preferred style. For more information about empty slices,
see Declaring Empty Slices.
Bad practice
package main
func foo() {
a := []int{}
}
Recommended
package main
func foo() {
var a []int
}