Golang初学:项目目录结构,project-layout 项目

go version go1.22.1 windows/amd64

Windows 11 + amd64

x86_64 x86_64 GNU/Linux

---

 

序章

golang 项目 的代码要怎么组织?怎么放比较简洁易读?看下面这个 项目 就晓得了。

 

project-layout

https://github.com/golang-standards/project-layout

注,有时访问失败。特写文记录。

 

Standard Go Project Layout

This is a basic layout for Go application projects.

Note that it's basic in terms of content because it's focusing only on the general layout and not what you have inside.

It's also basic because it's very high level and it doesn't go into great details in terms of how you can structure your project even further.

For example, it doesn't try to cover the project structure you'd have with something like Clean Architecture.

简体中文的 README:

https://github.com/golang-standards/project-layout/blob/master/README_zh-CN.md

这是Go应用程序项目的基础布局。

这不是Go核心开发团队定义的官方标准;无论是在经典项目还是在新兴的项目中,这都是Go生态系统中一组常见的项目布局模式。

这其中有一些模式比另外的一些更受欢迎。

它通过几个支撑目录为任何足够大规模的实际应用程序提供一些增强功能。

 

住,README 里面有更多各个目录的介绍,大家可以下载项目后查看。

 

project-layout 页面截图

240524 留存:

 

更多项目目录结构,可以参考其它优秀的 golang项目,比如,etcd、kubernetes 等。

 

END.

 

声明,如有侵权,请通知作者处理

 

本文链接:

https://www.cnblogs.com/luo630/p/18211696

 

ben发布于博客园

参考资料

1、

 

ben发布于博客园

ben发布于博客园

 

posted @ 2024-05-24 22:22  快乐的凡人721  阅读(20)  评论(0编辑  收藏  举报