# xinliangnote/go architecture

> Architecture diagram of the GitHub repository xinliangnote/go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xinliangnote/go
- Repository: https://github.com/xinliangnote/go

## Overview

This repository is a set of Go learning examples rather than one integrated application. Its main user journey is studying language basics, then exploring Gin HTTP services and a gRPC client/server example. The Gin chapters progress through routing, logging, binding and validation, and custom error handling. The graph groups related chapter implementations; several handler and middleware details are represented by their source directories because their files were not excerpted.

Main entry points: [`01-Gin框架/codes/04-数据绑定和验证/ginDemo/router/router.go`](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/router/router.go) (Validation routes), [`01-Gin框架/codes/05-自定义错误处理/ginDemo/router/router.go`](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/router/router.go) (Error-handling routes), [`02-Go gRPC/codes/01-gRPC Hello World/go_server/main.go`](https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/main.go) (gRPC server), [`01-Gin框架/codes/03-日志记录/ginDemo/main.go`](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/main.go) (Logging app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_basics["Go basics"]
  node_syntax["Syntax demos"]
end

subgraph group_gin["Gin examples"]
  node_gin02main["Routing app<br/>[main.go]"]
  node_gin02router["Versioned routes<br/>[router.go]"]
  node_gin02handlers["Route handlers"]
  node_gin03main["Logging app<br/>[main.go]"]
  node_gin03router["Logging routes<br/>[router.go]"]
  node_gin03handlers["Route handlers"]
  node_gin03logger["File logger<br/>[logger.go]"]
  node_gin04main["Validation app<br/>[main.go]"]
  node_gin04router["Validation routes<br/>[router.go]"]
  node_gin04handlers["Bound handlers"]
  node_gin04middleware["Request signing<br/>[sign.go]"]
  node_gin04validator["Member validator<br/>[member.go]"]
  node_gin05main["Error-handling app<br/>[main.go]"]
  node_gin05router["Error-handling routes<br/>[router.go]"]
  node_gin05handlers["Route handlers"]
  node_gin05middleware["Error middleware"]
end

subgraph group_grpc["gRPC example"]
  node_grpcclient["gRPC client<br/>[main.go]"]
  node_grpcserver["gRPC server<br/>[main.go]"]
  node_grpccontroller["Hello controller<br/>[hello_server.go]"]
  node_grpcproto["Hello service schema<br/>[hello.proto]"]
end

node_learner(("Learner"))
node_grpcnetwork(("gRPC network"))

node_learner -->|"studies"| node_syntax
node_learner -->|"explores routing"| node_gin02main
node_learner -->|"explores RPC"| node_grpcclient
node_gin02main -->|"initializes routes"| node_gin02router
node_gin02router -->|"registers handlers"| node_gin02handlers
node_gin03main -->|"initializes routes"| node_gin03router
node_gin03main -->|"installs logger"| node_gin03logger
node_gin03router -->|"registers handlers"| node_gin03handlers
node_gin04main -->|"initializes routes"| node_gin04router
node_gin04router -->|"registers handlers"| node_gin04handlers
node_gin04router -->|"installs signing"| node_gin04middleware
node_gin04router -->|"registers validation"| node_gin04validator
node_gin05main -->|"initializes routes"| node_gin05router
node_gin05router -->|"registers handlers"| node_gin05handlers
node_gin05router -->|"installs middleware"| node_gin05middleware
node_grpcclient -->|"calls service"| node_grpcnetwork
node_grpcnetwork -.->|"serves requests"| node_grpcserver
node_grpcserver -->|"registers service"| node_grpccontroller
node_grpcserver -->|"registers schema service"| node_grpcproto

click node_syntax "https://github.com/xinliangnote/go/tree/master/00-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/codes"
click node_gin02main "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/main.go"
click node_gin02router "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/router/router.go"
click node_gin02handlers "https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/controller"
click node_gin03main "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/main.go"
click node_gin03router "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/router/router.go"
click node_gin03handlers "https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/router"
click node_gin03logger "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/middleware/logger.go"
click node_gin04main "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/main.go"
click node_gin04router "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/router/router.go"
click node_gin04handlers "https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/router"
click node_gin04middleware "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/middleware/sign/sign.go"
click node_gin04validator "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/validator/member/member.go"
click node_gin05main "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/main.go"
click node_gin05router "https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/router/router.go"
click node_gin05handlers "https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/router"
click node_gin05middleware "https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/middleware"
click node_grpcclient "https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_client/main.go"
click node_grpcserver "https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/main.go"
click node_grpccontroller "https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/controller/hello_controller/hello_server.go"
click node_grpcproto "https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/proto/hello/hello.proto"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_syntax toneBlue
class node_gin02main,node_gin02router,node_gin02handlers,node_gin03main,node_gin03router,node_gin03handlers,node_gin03logger,node_gin04main,node_gin04router,node_gin04handlers,node_gin04middleware,node_gin04validator,node_gin05main,node_gin05router,node_gin05handlers,node_gin05middleware toneAmber
class node_grpcclient,node_grpcserver,node_grpccontroller,node_grpcproto toneMint
class node_learner,node_grpcnetwork toneIndigo
```

## Components

### Go basics

- [Syntax demos](https://github.com/xinliangnote/go/tree/master/00-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/codes): `00-基础语法/codes`

### Gin examples

- [Routing app](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/main.go): `01-Gin框架/codes/02-路由配置/ginDemo/main.go`
- [Versioned routes](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/router/router.go): `01-Gin框架/codes/02-路由配置/ginDemo/router/router.go`
- [Route handlers](https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/02-%E8%B7%AF%E7%94%B1%E9%85%8D%E7%BD%AE/ginDemo/controller): `01-Gin框架/codes/02-路由配置/ginDemo/controller`
- [Logging app](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/main.go): `01-Gin框架/codes/03-日志记录/ginDemo/main.go`
- [Logging routes](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/router/router.go): `01-Gin框架/codes/03-日志记录/ginDemo/router/router.go`
- [Route handlers](https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/router): `01-Gin框架/codes/03-日志记录/ginDemo/router`
- [File logger](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/03-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/ginDemo/middleware/logger.go): `01-Gin框架/codes/03-日志记录/ginDemo/middleware/logger.go`
- [Validation app](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/main.go): `01-Gin框架/codes/04-数据绑定和验证/ginDemo/main.go`
- [Validation routes](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/router/router.go): `01-Gin框架/codes/04-数据绑定和验证/ginDemo/router/router.go`
- [Bound handlers](https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/router): `01-Gin框架/codes/04-数据绑定和验证/ginDemo/router`
- [Request signing](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/middleware/sign/sign.go): `01-Gin框架/codes/04-数据绑定和验证/ginDemo/middleware/sign/sign.go`
- [Member validator](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/04-%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E5%92%8C%E9%AA%8C%E8%AF%81/ginDemo/validator/member/member.go): `01-Gin框架/codes/04-数据绑定和验证/ginDemo/validator/member/member.go`
- [Error-handling app](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/main.go): `01-Gin框架/codes/05-自定义错误处理/ginDemo/main.go`
- [Error-handling routes](https://github.com/xinliangnote/go/blob/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/router/router.go): `01-Gin框架/codes/05-自定义错误处理/ginDemo/router/router.go`
- [Route handlers](https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/router): `01-Gin框架/codes/05-自定义错误处理/ginDemo/router`
- [Error middleware](https://github.com/xinliangnote/go/tree/master/01-Gin%E6%A1%86%E6%9E%B6/codes/05-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/ginDemo/middleware): `01-Gin框架/codes/05-自定义错误处理/ginDemo/middleware`

### gRPC example

- [gRPC client](https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_client/main.go): `02-Go gRPC/codes/01-gRPC Hello World/go_client/main.go`
- [gRPC server](https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/main.go): `02-Go gRPC/codes/01-gRPC Hello World/go_server/main.go`
- [Hello controller](https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/controller/hello_controller/hello_server.go): `02-Go gRPC/codes/01-gRPC Hello World/go_server/controller/hello_controller/hello_server.go`
- [Hello service schema](https://github.com/xinliangnote/go/blob/master/02-Go%20gRPC/codes/01-gRPC%20Hello%20World/go_server/proto/hello/hello.proto): `02-Go gRPC/codes/01-gRPC Hello World/go_server/proto/hello/hello.proto`

### Other components

- **Learner**
- **gRPC network**

## Connections

- Learner → Syntax demos: studies
- Learner → Routing app: explores routing
- Learner → gRPC client: explores RPC
- Routing app → Versioned routes: initializes routes (evidence: `01-Gin框架/codes/02-路由配置/ginDemo/main.go`)
- Versioned routes → Route handlers: registers handlers (evidence: `01-Gin框架/codes/02-路由配置/ginDemo/router/router.go`)
- Logging app → Logging routes: initializes routes (evidence: `01-Gin框架/codes/03-日志记录/ginDemo/main.go`)
- Logging app → File logger: installs logger (evidence: `01-Gin框架/codes/03-日志记录/ginDemo/main.go`)
- Logging routes → Route handlers: registers handlers (evidence: `01-Gin框架/codes/03-日志记录/ginDemo/router/router.go`)
- Validation app → Validation routes: initializes routes (evidence: `01-Gin框架/codes/04-数据绑定和验证/ginDemo/main.go`)
- Validation routes → Bound handlers: registers handlers (evidence: `01-Gin框架/codes/04-数据绑定和验证/ginDemo/router/router.go`)
- Validation routes → Request signing: installs signing (evidence: `01-Gin框架/codes/04-数据绑定和验证/ginDemo/router/router.go`)
- Validation routes → Member validator: registers validation (evidence: `01-Gin框架/codes/04-数据绑定和验证/ginDemo/router/router.go`)
- Error-handling app → Error-handling routes: initializes routes (evidence: `01-Gin框架/codes/05-自定义错误处理/ginDemo/main.go`)
- Error-handling routes → Route handlers: registers handlers (evidence: `01-Gin框架/codes/05-自定义错误处理/ginDemo/router/router.go`)
- Error-handling routes → Error middleware: installs middleware (evidence: `01-Gin框架/codes/05-自定义错误处理/ginDemo/router/router.go`)
- gRPC client → gRPC network: calls service (evidence: `02-Go gRPC/codes/01-gRPC Hello World/go_client/main.go`)
- gRPC network → gRPC server: serves requests
- gRPC server → Hello controller: registers service (evidence: `02-Go gRPC/codes/01-gRPC Hello World/go_server/main.go`)
- gRPC server → Hello service schema: registers schema service (evidence: `02-Go gRPC/codes/01-gRPC Hello World/go_server/main.go`)
