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
派生數178
提交數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.