Skip to content

aggregateLanguageSummary returns nil instead of an empty slice #308

@jan-guenter

Description

@jan-guenter

In my PR #307 I introduced an error:
aggregateLanguageSummary returned nil instead of an empty slice in case of an empty input.

Sorry, my inexperience in Go fired back.
I was not really aware of the differences between:

language := []LanguageSummary{}

and

var language = []LanguageSummary

and blindly trusted the coding recommendation of GoLand to prefer the non-allocating version.

This issue caused the unit test TestToJSONEmpty to fail which I missed amongst all the other test currently failing in master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions