{"id":26235601,"url":"https://github.com/onexstack/design-pattern","last_synced_at":"2026-04-25T00:39:02.974Z","repository":{"id":280138822,"uuid":"829785991","full_name":"onexstack/design-pattern","owner":"onexstack","description":"最全的设计模式讲解。一共 58 种设计模式，包括 GoF 中的 24 种设计模式。","archived":false,"fork":false,"pushed_at":"2025-03-01T13:44:54.000Z","size":425,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-01T14:31:54.557Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onexstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T02:45:19.000Z","updated_at":"2025-03-01T13:44:57.000Z","dependencies_parsed_at":"2025-03-01T14:42:35.947Z","dependency_job_id":null,"html_url":"https://github.com/onexstack/design-pattern","commit_stats":null,"previous_names":["onexstack/design-pattern"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fdesign-pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fdesign-pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fdesign-pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onexstack%2Fdesign-pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onexstack","download_url":"https://codeload.github.com/onexstack/design-pattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330319,"owners_count":20274039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-13T03:16:38.233Z","updated_at":"2025-12-29T01:15:09.390Z","avatar_url":"https://github.com/onexstack.png","language":"Go","readme":"# Go 版设计模式（58 种）\n\n\u003e 云原生 AI 实战营项目之一，更多精彩项目见：[云原生 AI 实战营](https://konglingfei.com/)。\n\n本仓库是 [《Go 设计模式 61 讲》课程](https://konglingfei.com/cloudai/catalog/design-pattern.html) 的源码仓库。里面介绍了 58 种常见的设计模式，及 Go 版代码实现。\n\n如果你想全面学习这些设计模式，欢迎加入 [云原生 AI 实战营](https://konglingfei.com)。里面不仅包含了 《Go 设计模式 61 讲》课程，还包含了大量其他高质量的 Go、云原生、AI Infra 课程。\n\n\u003cbr/\u003e\n\n在 《Go 设计模式 61 讲》课程中一共介绍了 58 种设计模式，这些设计模式列表如下。\n\n## 创建型模式（Creational Patterns）\n\n| 模式名 | 英文名 | 状态 | \n| --- | --- | --- |\n|[简单工厂模式](./creational/simplefactory)|Simple Factory|✔|\n|[工厂方法模式](./creational/factorymethod)|Factory Method|✔|\n|[抽象工厂模式](./creational/abstractfactory)|Abstract Factory|✔|\n|[建造者模式](./creational/builder)|Builder|✔|\n|[原型模式](./creational/prototype)|Prototype|✔|\n|[单例模式](./creational/singleton)|Singleton|✔|\n|[New 模式](./creational/new)|New|✔|\n|[函数选项模式](./creational/functionaloption)|Functional Options|✔|\n|[对象池模式](./creational/objectpool)|Object Pool|✔|\n\n## 行为型模式（Behavioral Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[中介者模式](./behavioral/mediator)|Mediator|✔|\n|[观察者模式](./behavioral/observer)|Observer|✔|\n|[命令模式](./behavioral/command)|Command|✔|\n|[迭代器模式](./behavioral/iterator)|Iterator|✔|\n|[模版方法模式](./behavioral/templatemethod)|Template Method|✔|\n|[策略模式](./behavioral/strategy)|Strategy|✔|\n|[状态模式](./behavioral/state)|State|✔|\n|[备忘录模式](./behavioral/memento)|Memento|✔|\n|[解释器模式](./behavioral/interpreter)|Interpreter|✔|\n|[责任链模式](./behavioral/chainofresponsibility)|Chain of Responsibility|✔|\n|[访问者模式](./behavioral/observer)|Visitor|✔|\n|[注册表模式](./behavioral/registry)|Registry|✔|\n|[上下文模式](./behavioral/context)|Context|✔|\n\n## 结构型模式（Structural Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[外观模式](./structural/facade)|Facade|✔|\n|[适配器模式](./structural/adapter)|Adapter|✔|\n|[代理模式](./structural/proxy)|Proxy|✔|\n|[组合模式](./structural/composite)|Composite|✔|\n|[享元模式](./structural/flyweight)|Flyweight|✔|\n|[装饰器模式](./structural/decorator)|Decorator|✔|\n|[桥接模式](./structural/adapter)|Bridge|✔|\n\n## 同步模式（Synchronization Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[条件变量模式](./synchronization/condition)|Condition Variable|✔|\n|[互斥锁模式](./synchronization/lockmutex)|Lock/Mutex|✔|\n|[监视器模式](./synchronization/monitor)|Monitor|✔|\n|[读写锁模式](./synchronization/readwritelock)|Read-Write Lock|✔|\n|[信号量模式](./synchronization/semaphore)|Semaphore|✔|\n\n## 并发模式（Concurrency Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[屏障模式](./concurrency/barrier)|N-Barrier|✔|\n|[有界并行性模式](./concurrency/boundedparallelism)|Bounded Parallelism|✔|\n|[广播模式](./concurrency/broadcast)|Broadcast|✔|\n|[协程模式](./concurrency/coroutines)|Coroutines|✔|\n|[生成器模式](./concurrency/generator)|Generator|✔|\n|[反应器模式](./concurrency/reactor)|Reactor|✔|\n|[并行模式](./concurrency/parallelism)|Parallelism|✔|\n|[生产者消费者模式](./concurrency/producerconsumer)|Producer Consumer|✔|\n|[批处理模式](./concurrency/batcher)|Batch Processing|✔|\n\n## 消息传递模式（Messaging Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[扇入模式](./messaging/fanin)|Fan-In|✔|\n|[扇出模式](./messaging/fanout)|Fan-Out|✔|\n|[未来与承诺模式](./messaging/futurespromises)|Futures \u0026 Promises|✔|\n|[发布订阅模式](./messaging/pubsub)|Publish/Subscribe|✔|\n|[推模式与拉模式](./messaging/pushpull)|Push \u0026 Pull|✔|\n\n## 稳定型模式（Stability Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[隔离模式](./stability/bulkhead)|Bulkheads|✔|\n|[断路器模式](./stability/circuit)|Circuit-Breaker|✔|\n|[截止期限模式](./stability/deadline)|Deadline|✔|\n|[快速失败模式](./stability/failfast)|Fail-Fast|✔|\n|[握手模式](./stability/handshaking)|Handshaking|✔|\n|[稳态模式](./stability/steadystate)|Steady-State|✔|\n|[限流模式](./stability/ratelimiting)|Rate Limiting|✔|\n|[重试模式](./stability/retrier)|Retrier|✔|\n\n## 分析模式（Profiling Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[计时函数模式](./profiling/timing)|Timing Functions|✔|\n\n## 反模式（Anti-Patterns）\n\n| 模式名 | 英文名 | 状态 |\n| --- | --- | --- |\n|[串联故障模式](./anti/cascadingfailures)|Cascading Failures|✔|\n\n## 参考资料\n\n| 推荐顺序| 项目名 | 参考星级 | 参考状态 |\n| --- | --- | --- | --- |\n| 1 | [crazybber/go-pattern-examples](https://github.com/crazybber/go-pattern-examples) | ★★★★★ |✔|\n| 2 | [crazybber/awesome-patterns](https://github.com/crazybber/awesome-patterns) | ★★★★★ |✔|\n| 3 | [tmrts/go-patterns](https://github.com/tmrts/go-patterns) | ★★★★ |✔|\n| 4 | [senghoo/golang-design-pattern](https://github.com/senghoo/golang-design-pattern) | ★★★ |✔|\n| 5 | [lee501/go-patterns](https://github.com/lee501/go-patterns) | ★★★ |✔|\n| 6 | [mohuishou/go-design-pattern](https://github.com/mohuishou/go-design-pattern) | ★★★ |✔|\n\n## Contacts\n\n\u003cimg src=\"./images/three-code.png\" alt=\"\" width=\"900\" /\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonexstack%2Fdesign-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonexstack%2Fdesign-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonexstack%2Fdesign-pattern/lists"}