While use of named returns is not directly wrong, it is a matter of taste whether to use them or not. From experience it has a tendency to cause confusion both when understanding code and immediately seeing what data is actually returned. There are a few cases where named returns are needed but we should be explicit when using them in these cases.
While use of named returns is not directly wrong, it is a matter of taste whether to use them or not. From experience it has a tendency to cause confusion both when understanding code and immediately seeing what data is actually returned. There are a few cases where named returns are needed but we should be explicit when using them in these cases.
Checking for named returns can be done with the linter using
nonamedreturns
. https://golangci-lint.run/usage/linters/#nonamedreturns