whatisgithub

What is golang-design-pattern?

senghoo/golang-design-pattern — explained in plain English

Analysis updated 2026-06-24

9,022GoAudience · developerComplexity · 1/5Setup · easy

In one sentence

A learning reference with working Go code examples for all 23 classic software design patterns, creational, structural, and behavioral, organized one pattern per folder.

Mindmap

mindmap
  root((golang-design-pattern))
    Creational
      Factory patterns
      Builder
      Singleton
    Structural
      Adapter
      Decorator
      Proxy
    Behavioral
      Observer
      Strategy
      Command
    Learning
      Code examples
      Pattern reference
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Study how classic design patterns like Observer, Strategy, or Singleton look when implemented in Go.

USE CASE 2

Use as a quick reference when adding a Decorator or Proxy pattern to your own Go project.

USE CASE 3

Learn software design patterns for the first time using real working code alongside a textbook.

USE CASE 4

Compare multiple patterns side by side to decide which one fits your current architecture problem.

What is it built with?

Go

How does it compare?

senghoo/golang-design-patternhashicorp/raftpinchtab/pinchtab
Stars9,0229,0109,041
LanguageGoGoGo
Setup difficultyeasyhardmoderate
Complexity1/54/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

So what is it?

This repository is a collection of example code in Go that demonstrates classic software design patterns. Design patterns are reusable solutions to common problems that come up repeatedly when building software. Rather than inventing a new approach every time, developers use these named patterns as a shared vocabulary and starting point. The repository is described as reading notes from the book "Research on Design Patterns" and covers 23 patterns organized into three categories. The first category, creational patterns, covers ways to create objects: Simple Factory, Factory Method, Abstract Factory, Builder, Prototype, and Singleton. The second category, structural patterns, covers how to organize or combine components: Facade, Adapter, Proxy, Composite, Flyweight, Decorator, and Bridge. The third category, behavioral patterns, covers how components communicate and coordinate: Mediator, Observer, Command, Iterator, Template Method, Strategy, State, Memento, Interpreter, Chain of Responsibility, and Visitor. Each pattern has its own folder in the repository containing Go code that shows how to implement it. The README is written in Chinese and serves mainly as an index linking to each of the 23 pattern folders on GitHub. This is primarily a learning resource. If you are studying Go and want to understand how established design patterns look when written in Go specifically, or if you are learning design patterns for the first time and want working code examples alongside your reading, this repository provides a concise reference.

Copy-paste prompts

Prompt 1
I am implementing the Observer pattern in my Go project. Show me how the example in golang-design-pattern works and help me adapt it to notify subscribers when a database record changes.
Prompt 2
Explain the difference between the Factory Method and Abstract Factory patterns using the Go code examples from golang-design-pattern, in plain English.
Prompt 3
I want to refactor a large switch statement in my Go code using the Strategy pattern. Walk me through the strategy pattern example and how to apply it to my situation.
Prompt 4
Help me understand when to use the Decorator pattern versus the Proxy pattern in Go, using the golang-design-pattern examples as a reference.

Frequently asked questions

What is golang-design-pattern?

A learning reference with working Go code examples for all 23 classic software design patterns, creational, structural, and behavioral, organized one pattern per folder.

What language is golang-design-pattern written in?

Mainly Go. The stack also includes Go.

How hard is golang-design-pattern to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is golang-design-pattern for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.