Avoid empty array allocations

This commit is contained in:
Conrad Hoffmann 2022-03-16 15:08:42 +01:00
parent e5db18e289
commit 29bf819ab1

View File

@ -135,7 +135,7 @@ func createDefaultAddressBook(path string) error {
Name: "My contacts", Name: "My contacts",
Description: "Default address book", Description: "Default address book",
MaxResourceSize: 1024, MaxResourceSize: 1024,
SupportedAddressData: []carddav.AddressDataType{}, SupportedAddressData: nil,
} }
blob, err := json.MarshalIndent(defaultAB, "", " ") blob, err := json.MarshalIndent(defaultAB, "", " ")
if err != nil { if err != nil {
@ -211,7 +211,7 @@ func (b *filesystemBackend) GetAddressObject(ctx context.Context, path string, r
} }
func (b *filesystemBackend) loadAll(ctx context.Context, propFilter []string) ([]carddav.AddressObject, error) { func (b *filesystemBackend) loadAll(ctx context.Context, propFilter []string) ([]carddav.AddressObject, error) {
result := []carddav.AddressObject{} var result []carddav.AddressObject
path, err := b.pathForContext(ctx) path, err := b.pathForContext(ctx)
if err != nil { if err != nil {