cosmos-sdk
cosmos-sdk copied to clipboard
[Code Style] Appropriate suffix/prefix for interface definitions
Various interfaces in the codebase, such as AccountKeeperI are implemented with the I as a postfix.
I couldn't find official Golang guidelines, but this post suggests:
And Dave Cheney's Practical Go uses the same pattern:
Is it fair to assume that this is just a legacy thing someone did that stuck around or is there an explicit reason for this design pattern?
I'm not opposed to renaming interfaces that have the I suffix 👍
I think I added these way back then when I didn't know this existed.
Should be a straightforward PR with a few global find/replace operations. I'm happy to submit a PR with the changes.
Just wanted to make sure I have a 👍 to replace type (.*)[a-z]I interface \{ with type I(.*)[a-z] interface \{ throughout the codebase before I spend time making the changes and running the tests.
Sure @Olshansk! Thanks :)
Sounds great :)
https://github.com/cosmos/cosmos-sdk/pull/13268
https://medium.com/@dotronglong/interface-naming-convention-in-golang-f53d9f471593
This guidance is incorrect.
Closing as per https://github.com/cosmos/cosmos-sdk/pull/13268#issuecomment-1296096676