Skip to content

all: remove Go parameter names for func defs

Administrator requested to merge rvt/simplify-sig into main

Created by: rvantonder

This PR is just a proposal for discussion:

How do people feel about function definition style like:

type foo func(name type) versus just type foo func(type) ?

I think I prefer the latter, but out of habit tend to write the former. The name usually doesn't add much to the signature (like ctx context.Context ok lol), and when I go back to my code and see what I did I tend to "fix it" and delete name.

More examples in our code base where the name can go away: https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/sourcegraph/sourcegraph%24+type+:%5B%5Bw%5D%5D+func%28:%5B%5Bx%5D%5D+:%5By:e%5D%29+lang:go&patternType=structural

This PR removes all unneeded param names in function type signatures.

comby \
'type :[[w]] func(:[[x]] :[y:e])' \
'type :[w] func(:[y:e])' \
'' \
-rg "-g '*.go'" -stats -i

Merge request reports

Loading