Skip to content

About

go语言学习项目

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go 企业应用学习起步项目

这个项目是为有 Java 开发经验的工程师准备的 Go 入门脚手架。
目标是让你通过一个可运行、可测试、可扩展的最小企业应用,掌握 Go 项目结构与开发流程。

项目结构

.
├── cmd/
│   └── api/                 # 应用入口(main)
├── internal/
│   ├── app/                 # 依赖装配
│   ├── config/              # 配置加载(环境变量)
│   ├── httpserver/          # HTTP 服务与优雅停机
│   ├── response/            # 统一 JSON 响应
│   └── user/                # 示例业务模块(handler/service/repository)
├── docs/
│   └── learning-path.md     # 逐步学习路线(含 Java vs Go 对比)
├── Makefile
└── go.mod

快速开始

  1. 运行测试
make test
  1. 启动服务
make run
  1. 验证接口
curl http://localhost:8080/health
curl -X POST http://localhost:8080/v1/users \
  -H 'Content-Type: application/json' \
  -d '{"name":"Alice","email":"alice@example.com"}'
curl http://localhost:8080/v1/users

环境变量

  • APP_HTTP_HOST 默认 0.0.0.0
  • APP_HTTP_PORT 默认 8080
  • APP_HTTP_READ_TIMEOUT 默认 5s
  • APP_HTTP_WRITE_TIMEOUT 默认 10s
  • APP_HTTP_SHUTDOWN_TIMEOUT 默认 10s

学习建议

从 docs/learning-path.md 开始,按阶段逐步实践。
每完成一个阶段后,在当前代码基础上进行一次小迭代(加接口、加测试、加中间件、接数据库)。

About

go语言学习项目

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages