Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code Style] Appropriate suffix/prefix for interface definitions #13254

Closed
Olshansk opened this issue Sep 12, 2022 · 6 comments
Closed

[Code Style] Appropriate suffix/prefix for interface definitions #13254

Olshansk opened this issue Sep 12, 2022 · 6 comments

Comments

@Olshansk
Copy link

Various interfaces in the codebase, such as AccountKeeperI are implemented with the I as a postfix.

Screen Shot 2022-09-12 at 6 07 23 PM

I couldn't find official Golang guidelines, but this post suggests:

Screen Shot 2022-09-12 at 6 08 04 PM

And Dave Cheney's Practical Go uses the same pattern:

Screen Shot 2022-09-12 at 6 08 32 PM

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?

@alexanderbez
Copy link
Contributor

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.

@Olshansk
Copy link
Author

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.

Screen Shot 2022-09-13 at 9 28 57 AM

@alexanderbez
Copy link
Contributor

Sure @Olshansk! Thanks :)

@Olshansk
Copy link
Author

Sounds great :)

#13268

@peterbourgon
Copy link

@julienrbrt julienrbrt closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2022
@julienrbrt
Copy link
Member

Closing as per #13268 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants