pkg directory should not be recommended for use
The general consensus of the Go community has been converging on the idea that the `pkg/` directory is a useless abstraction / indirection. Instead, people are encouraged to either put the packages in the top-level of the repository, or to create a repository structure that structures things based on their primary functionality of domain in the business logic. So while in your example you may encourage people to have the following layout: ``` pkg/ server/ handlers/ poller/ config/ manager/ ``` We instead would prefer: ``` server/ handlers/ poller/ config/ manager/ ``` This may seem innocuous, but because this project has asserted itself as some sort of Go standards body what is being recommended here is being taken seriously. In the Slack workspace, where there are over 30k registered users, we quite often need to correct people who are using `pkg/` and have them ignore the recommendations here. Some of the things recommended here are good, and I'd like to be able to use them as a resource. That said, considering the current `pkg/` recommendation we're hard-pressed to use this as a resource because we have to tell people to ignore certain parts.
Posted by theckman on Aug 14, 2018, 3:59 PM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
pkg directory should not be recommended for use
The general consensus of the Go community has been converging on the idea that the `pkg/` directory is a useless abstraction / indirection. Instead, people are encouraged to either put the packages in the top-level of the repository, or to create a repository structure that structures things based on their primary functionality of domain in the business logic. So while in your example you may encourage people to have the following layout: ``` pkg/ server/ handlers/ poller/ config/ manager/ ``` We instead would prefer: ``` server/ handlers/ poller/ config/ manager/ ``` This may seem innocuous, but because this project has asserted itself as some sort of Go standards body what is being recommended here is being taken seriously. In the Slack workspace, where there are over 30k registered users, we quite often need to correct people who are using `pkg/` and have them ignore the recommendations here. Some of the things recommended here are good, and I'd like to be able to use them as a resource. That said, considering the current `pkg/` recommendation we're hard-pressed to use this as a resource because we have to tell people to ignore certain parts.
Comments (0)
No comments yet. Start the discussion.