by gorgoiler · 4y ago · 0 comments
If I want to change the contract of get_kittens so that it returns a set instead of a list, I found it quite tiresome to then go to all the call sites of get_kittens and change their types to match.
What was I doing wrong?* Perhaps there’s a cleverer tool out there that can infer and implement these type changes for me, automatically?
* using vim? [joke]
1. Use `:=` whenever you can, so types are inferred by the assignments/allocations 2. Alternatively query all references from `gopls` and put the results into quick fix list, then `:cdo`
(Not to a level something like Typescript has it, but I'll argue that's a win. Typescript inferred typing can be hard to follow.)