Skip to content

Use named result parameters more sparingly #121

@lorenzleutgeb

Description

@lorenzleutgeb

Quoting Effective Go:

The names are not mandatory but they can make code shorter and clearer: they're documentation. If we name the results of nextInt it becomes obvious which returned int is which.

So, named results are means of documentation, e.g. to make clear the purpose of a returned value. They are not there to enable short returns and skipping initialization.
I have the feeling that we abuse this language feature in our code. One indicator is that we return values instead of pointers in a lot of places.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions