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

refactor utils #373

Closed
ilgooz opened this issue Aug 17, 2018 · 4 comments
Closed

refactor utils #373

ilgooz opened this issue Aug 17, 2018 · 4 comments
Assignees
Milestone

Comments

@ilgooz
Copy link
Contributor

ilgooz commented Aug 17, 2018

i see that we have quite a lot utils.go, utils package inside the project. i think we should reduce them and serve under a root level utils package as possible but use different package names for each different util under utils/ e.g.:

util/
  gitutil/ > gitutil.Clone()

lets also give a second check to this article about package namings: https://blog.golang.org/package-names

related with this comment.

@ilgooz ilgooz added this to To do in v1.2 via automation Aug 17, 2018
@ilgooz ilgooz added this to the v1.2.0 milestone Aug 17, 2018
@krhubert
Copy link
Contributor

I propose struct like here:

https://github.com/krhubert/gox

We have already xpflag in our repo. Maybe add x/ directory under repo root:

x/
  xgit/
  xpflag/
  x....

util can be used for things that won't fit into any extensions (or totally different purpose)...

@ilgooz
Copy link
Contributor Author

ilgooz commented Aug 17, 2018

i like the name x instead using util but is there any meaning of x anyway?

@krhubert
Copy link
Contributor

yep x stands for eXtension and it's there to not get the same name for 2 pkgs (also importing git pkg into git pkg - or any other pkg name - can lead to ugly/error-prone code). I preffer x over util only because is shorter.

@ilgooz
Copy link
Contributor Author

ilgooz commented Aug 17, 2018

i like the x name but i also like to stay package agnostic while naming x packages. in this context xgit should be getting its name because it's related with Git, not for extending a feature of github.com/src-d/go-git. this way we can also put generic utils under x package without worrying about if its name fits with a existing package.

@krhubert krhubert moved this from To do to Needs review in v1.2 Aug 24, 2018
@NicolasMahe NicolasMahe moved this from Needs review to Changes requested in v1.2 Aug 27, 2018
@NicolasMahe NicolasMahe removed this from Changes requested in v1.2 Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants