Closed butuzov closed 2 years ago
varnamelen can now infer the type of expressions, so this should work now.
This will be in varnamelen 0.6.0. Please note that it may take a while before 0.6.0 will make it into golangci-lint.
Awesome @blizzy78 !
One more note: The current implementation works for one-to-one single-valued assignments only. It shouldn't be very hard to support multi-assignments as well in the future, though.
varnamelen v0.7.0 contains improvements to the way the types of idents are inferred, so multi-value assigments should work now, too.
It would be great if linter can find the type of variable as a result of the function assigment. Like in next example.
For example this is how we can make it working now.
I am using it as part of
golangci-lint
with the next configuration.