Modern Go Application

现代 Go 应用实例。「Modern Go Application example」

Github星跟踪图

现代 Go 应用(Modern Go Application)

Go 应用模板和应用现代实践的例子。

这个资源库试图收集使用 Go 语言进行应用开发的最佳实践。除了具体的语言细节,它还实现了各种独立于语言的实践。

现代 Go 应用涉及的一些领域:

  • 架构
  • 封装结构
  • 构建应用程序
  • 检验
  • 配置
  • 运行应用程序(例如在Docker中)
  • 开发者环境/经验
  • 遥测

为了帮助采用这些做法,这个资源库也可以作为新应用的模板。

特性

初步步骤

要从模板中创建一个新的应用程序,请将这个仓库克隆(如果你还没有这样做的话)到你的 GOPATH 中,然后执行以下内容:

chmod +x init.sh && ./init.sh
? Package name (github.com/sagikazarmark/modern-go-application)
? Project name (modern-go-application)
? Binary name (modern-go-application)
? Service name (modern-go-application)
? Friendly service name (Modern Go Application)
? Update README (Y/n)
? Remove init script (y/N) y

它将版本库中的每个导入路径和名称更新为你的项目的值。查看并提交更改。

负载生成

为了测试或演示应用程序,它带有一个简单的负载生成工具。您可以使用它来测试示例端点并生成一些负载(例如,为了用数据填充仪表盘)。

请按照 etc/loadgen 中的说明进行操作。

灵感

请看 INSPIRATION.md,里面有一些文章、项目、代码例子的链接,这些都是我在做这个项目的时候受到的启发。

许可证

麻省理工学院许可证(MIT)。更多信息请参见许可证文件


主要指标

概览
名称与所有者sagikazarmark/modern-go-application
主编程语言Go
编程语言Dockerfile (语言数: 8)
平台Docker, Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2018-09-14 12:19:02
推送于2024-11-01 10:29:52
最后一次提交
发布数14
最新版本名称0.3.0 (发布于 )
第一版名称0.1.0-dev.1 (发布于 2019-01-17 20:14:42)
用户参与
星数1.9k
关注者数33
派生数180
提交数882
已启用问题?
问题数42
打开的问题数18
拉请求数114
打开的拉请求数5
关闭的拉请求数7
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

Modern Go Application

Mentioned in Awesome Go
Go Report Card
GolangCI
GoDoc

GitHub Workflow Status
CircleCI
Gitlab

Go application boilerplate and example applying modern practices

This repository tries to collect the best practices of application development using Go language.
In addition to the language specific details, it also implements various language independent practices.

Some of the areas Modern Go Application touches:

  • architecture
  • package structure
  • building the application
  • testing
  • configuration
  • running the application (eg. in Docker)
  • developer environment/experience
  • telemetry

To help adopting these practices, this repository also serves as a boilerplate for new applications.

Features

First steps

To create a new application from the boilerplate clone this repository (if you haven't done already) into your GOPATH
then execute the following:

chmod +x init.sh && ./init.sh
? Package name (github.com/sagikazarmark/modern-go-application)
? Project name (modern-go-application)
? Binary name (modern-go-application)
? Service name (modern-go-application)
? Friendly service name (Modern Go Application)
? Update README (Y/n)
? Remove init script (y/N) y

It updates every import path and name in the repository to your project's values.
Review and commit the changes.

Load generation

To test or demonstrate the application it comes with a simple load generation tool.
You can use it to test the example endpoints and generate some load (for example in order to fill dashboards with data).

Follow the instructions in etc/loadgen.

Inspiration

See INSPIRATION.md for links to articles, projects, code examples that somehow inspired
me while working on this project.

License

The MIT License (MIT). Please see License File for more information.