4 ms·
> it's idiomatic in go to use short names like chan though There's a linter which I like[1] that checks variable name length based on the scope of its usage.
by quacker 2y ago
> it's idiomatic in go to use short names like chan though
There's a linter which I like[1] that checks variable name length based on the scope of its usage.
The idea is a variable name can be short if it is used in a small lexical scope (e.g. a function parameter in a one-line function) because it won't affect readability much. But names should be descriptive if used in a larger scope (e.g. a constant used across a file).
1. https://github.com/blizzy78/varnamelen https://github.com/blizzy78/varnamelen
- inhumantsar 2y agooh this sounds great! thanks for sharing