-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added pkg directory to host importable packages #69
Conversation
Codecov Report
@@ Coverage Diff @@
## master #69 +/- ##
=======================================
Coverage 71.37% 71.37%
=======================================
Files 91 91
Lines 6022 6022
=======================================
Hits 4298 4298
Misses 1500 1500
Partials 224 224
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1ffd628
@songy23 done, thanks. |
Added a new pkg sub-directory that hosts code intended to be imported by 3rd party packages. Packages with `internal` in their import path cannot be imported by other Go programs. This is enforced by the compiler. Some of the code currently hosted by the internal director needs to be made available to other programs so additional exporters, receivers and processors can be easily implemented independently.
I think there was a long conversation about using pkg. And we decided to not do that. |
@bogdandrutu can you please point to the discussion or if you remember the arguments post here? |
@owais I tend to agree with some of the arguments against I do not see much benefits in I'd like to know what you think about this. We probably need a broader discussion about code organization. I think the codebase could generally benefit from better organization (something along the clean architecture lines: https://medium.com/@eminetto/clean-architecture-using-golang-b63587aa5e3f - so a layered organization with one clear direction of dependencies). |
I don't have any strong preference for |
If you need the code to be "public" put it in a directory directly in the root project not in internal. |
My understanding is that It then leaves everything else to be public. Even |
I'll move it all outside but have a question about the config packages. We could move the config packages to the project root or we could create a
I like that everything related to config will be inside the config "container". I don't like that the import path lies about the package name. I mean when importing Option 1.
Option 2.
Interested in hearing what everyone thinks. |
I would move all models to a separate package. Granted, we currently have only config models but there can be more. I find that it is reasonable that models are a separate package. They are the glue that holds other packages together and they should be importable from any other package. At the same time other package should be more careful about importing each other. So I would do this:
|
Moved out of |
User formatting assistance and user error checking
Added a new pkg sub-directory that hosts code intended to be imported by
3rd party packages.
Packages with
internal
in their import path cannot be imported byother Go programs. This is enforced by the compiler. Some of the code
currently hosted by the internal director needs to be made available to
other programs so additional exporters, receivers and processors can be
easily implemented independently.
As an alternative to
/pkg
we can also move them to project root but a lot of packages there might add clutter. I'm fine with either approach.