Modern Go Application

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

Github stars Tracking Chart

现代 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)。更多信息请参见许可证文件


Main metrics

Overview
Name With Ownersagikazarmark/modern-go-application
Primary LanguageGo
Program languageDockerfile (Language Count: 8)
PlatformDocker, Linux, Mac, Windows
License:MIT License
所有者活动
Created At2018-09-14 12:19:02
Pushed At2024-11-01 10:29:52
Last Commit At
Release Count14
Last Release Name0.3.0 (Posted on )
First Release Name0.1.0-dev.1 (Posted on 2019-01-17 20:14:42)
用户参与
Stargazers Count1.9k
Watchers Count33
Fork Count178
Commits Count882
Has Issues Enabled
Issues Count42
Issue Open Count18
Pull Requests Count114
Pull Requests Open Count5
Pull Requests Close Count7
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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.