TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Official guide for organizing Go projects and modules

83 pointsby dondraper36over 1 year ago

5 comments

dondraper36over 1 year ago
Finally, there is an official document with recommended ways to structure your Go project.<p>To be honest, it&#x27;s really minimal and liberal but that is definitely better than what is by an unfortunate name collision considered the official Go layout now.
评论 #37688041 未加载
评论 #37577948 未加载
mmcallisterover 1 year ago
Compare and contrast this with the Go Standards project-layout repo example[1] - which ironically is not a standard at all.<p>Personally I prefer a bit more rigidity in how the project is structured (&#x2F;pkg&#x2F;, &#x2F;pkg&#x2F;internal&#x2F;, &#x2F;cmd&#x2F;) since it is more opinionated and requires less thinking. Typically my repos won&#x27;t just have a Go backend but also a frontend too, and supporting assets, as well as documentation (designs, decisions, etc.)<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;golang-standards&#x2F;project-layout">https:&#x2F;&#x2F;github.com&#x2F;golang-standards&#x2F;project-layout</a>
Zababaover 1 year ago
I knew it reminded me of something! Eli Bendersky&#x27;s post <a href="https:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;2019&#x2F;simple-go-project-layout-with-modules&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;2019&#x2F;simple-go-project-layout-...</a> now starts with &quot;Update (2023-09-19): We&#x27;ve now published similar guidelines as part of Go&#x27;s official documentation. This blog post will remain up-to-date.&quot; I&#x27;ve learned a lot about Go from this website.
js2over 1 year ago
Questions left unanswered:<p>- When are go multi-module workspaces best used?<p>- What should you use for the module-path argument to `go mod init` if you don&#x27;t ever intend to share the repo or you don&#x27;t yet know where you will be sharing it?
评论 #37580227 未加载
评论 #37581222 未加载
burgerritoover 1 year ago
Is this a new page? Don&#x27;t remember if I&#x27;ve read this one or not.