{"id":20314864,"url":"https://github.com/windvalley/go-design-patterns","last_synced_at":"2025-10-14T04:37:06.089Z","repository":{"id":163372281,"uuid":"323255581","full_name":"windvalley/go-design-patterns","owner":"windvalley","description":"Design patterns implemented in Go","archived":false,"fork":false,"pushed_at":"2021-05-28T10:09:10.000Z","size":170,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-12T12:48:26.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/windvalley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-21T06:55:49.000Z","updated_at":"2025-01-07T13:23:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"432f791f-13e8-43fe-9cfa-a074291c2c0e","html_url":"https://github.com/windvalley/go-design-patterns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/windvalley/go-design-patterns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgo-design-patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgo-design-patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgo-design-patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgo-design-patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windvalley","download_url":"https://codeload.github.com/windvalley/go-design-patterns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgo-design-patterns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017931,"owners_count":26086213,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-14T18:16:59.804Z","updated_at":"2025-10-14T04:37:06.050Z","avatar_url":"https://github.com/windvalley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-design-patterns [![Go Report Card](https://goreportcard.com/badge/github.com/windvalley/go-design-patterns)](https://goreportcard.com/report/github.com/windvalley/go-design-patterns) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=windvalley_go-design-patterns\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=windvalley_go-design-patterns) [![codecov](https://codecov.io/gh/windvalley/go-design-patterns/branch/main/graph/badge.svg?token=UV7V4WC03R)](https://codecov.io/gh/windvalley/go-design-patterns)\n\nDesign patterns implemented in Go\n\n## Creational Patterns\n\n- [x] [Simple Factory](/simple_factory/)  \nWhen you need an object, just pass a correct parameter to the function, and you can get the object you need without knowing the details of its creation.\n- [x] [Factory Method](/factory_method/)  \nDefers instantiation of an object to a specialized function for creating instances.\n- [x] [Abstract Factory](/abstract_factory/)  \nProvides an interface for creating families of releated objects.\n- [x] [Singleton](/singleton/)  \nRestricts instantiation of a type to one object.\n- [x] [Builder](/builder/)  \nSplit a large object into multiple small objects, then assemble multiple small objects into large objects, and hide the construction process from the outside.\n- [x] [Prototype](/prototype/)  \nReturn a new instance by copying an existing instance, rather than creating a new one, which is mostly used to create complex or time-consuming instances.\n- [x] [Object Pool](/object_pool/)  \nInstantiates and maintains a group of objects instances of the same type.\n\n## Structural Patterns\n\n- [x] [Proxy](/proxy/)  \nProvides a surrogate for an object to control it's actions, for example, to delay its actions or to perform other processing before and after its actions.\n- [x] [Bridge](/bridge/)  \nDecouples an interface from its implementation so that the two can vary independently.\n- [x] [Decorator](/decorator/)  \nAdds behavior to an object, statically or dynamically.\n- [x] [Adapter](/adapter/)  \nConvert incompatible interfaces to compatible interfaces so that objects that cannot work together due to incompatible interfaces can work together.\n- [x] [Facade](/facade/)  \nUses one type as an API to a number of others.\n- [x] [Composite](/composite/)  \nSometimes it is more directly called the tree pattern, which is used to unify the access of leaf node objects and non-leaf node objects.\n- [x] [Flyweight](/flyweight/)  \nReuses existing instances of objects with similar/identical state to minimize resource usage.\n\n## Behavioral Patterns\n\n- [x] [Observer](/observer/)  \nThe observer pattern allows a type instance to publish events to other type instances(observers) who wish to be updated when a particular event occurs.\n- [x] [Template Method](/template_method/)  \nDefines a skeleton class which defers some methods to subclasses.\n- [x] [Strategy](/strategy/)  \nEnables an algorithm's behavior to be selected at runtime.\n- [x] [Chain of Responsibility](/chain_of_responsibility/)  \nAvoids coupling a sender to receiver by giving more than object a chance to handle the request.\n- [x] [State](/state/)  \nEncapsulates varying behavior for the same object based on its internal state.\nThe main point is create objects representing various states,\nand a context object whose behavior changes as its internal state object changes.\n- [x] [Iterator](/iterator/)  \nSplit complex traversal operations into iterator objects.\n- [x] [Visitor](/visitor/)  \nSeparates an algorithm from an object on which it operates.\nThe element object accepts the visitor object so that the visitor object can handle operations on the element object.\nThe intention is to separate data structure from data manipulation.\nTo solve the coupling problem between stable data structure and volatile operation.\n- [x] [Memento](/memento/)  \nCapture the internal state of an object and save this state outside the object,\nso that the object can be restored to the original state in the future.\n- [x] [Command](/command/)  \nBundles a command and arguments to call later.\n- [x] [Interpreter](/interpreter/)  \nDefines a grammatical representation for a language and provides an interpreter to deal with this grammar.\n- [x] [Mediator](/mediator/)  \nMediator connects objects and acts as a proxy.\n\n## Other Patterns\n\n### Synchronization Patterns\n\n- [x] [Semaphore](/semaphore/)  \nAllows controlling access to a common resource.\n\n### Concurrency Patterns\n\n- [x] [Parallelism](/parallelism/)  \nCompletes large number of independent tasks.\n- [x] [Bounded Parallelism](/bounded_parallelism/)  \nCompletes large number of independent tasks with resource limits.\n- [x] [Generators](/generators/)  \nYields a sequence of values one at a time.\n\n### Messaging Patterns\n\n- [x] [Fan In](/fan_in/)  \nFunnels tasks to a work sink (e.g. server).\n- [x] [Fan Out](/fan_out/)  \nDistributes tasks among workers (e.g. producer).\n\n### Profiling Patterns\n\n- [x] [Timing Functions](/timing_functions/)  \nMeasure the execution time of some functions for code optimization.\n\n### Idioms\n\n- [x] [Build Options](/build_options/)  \nOptional parameters use chained function calls to construct an object.\n- [x] [Functional Options](/functional_options/)  \nAllows creating clean APIs with sane defaults and idiomatic overrides.\n- [x] [Inversion of Control](/inversion_of_control/)  \nSeparate the control logic from the business logic.\nDo not write the control logic in the business logic,\nbecause this will make the control logic depend on the business logic,\nbut in turn, let the business logic depend on the control logic.\n- [x] [Map Reduce](/map_reduce/)  \nMap, Reduce, and Filter allow us to perform some data processing easily and flexibly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Fgo-design-patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindvalley%2Fgo-design-patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Fgo-design-patterns/lists"}