New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/alex-leonhardt/go-decorator-pattern

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/alex-leonhardt/go-decorator-pattern

  • v0.0.0-20171031223552-d4c1c5a7354b
  • Source
  • Go
  • Socket score

Version published
Created
Source

golang and the decorator pattern

a playground for me (and maybe helpful for others?) to train the brain understand the decorator pattern better

  • a basic function decorator, see example1
  • a basic timing decorator (how long does func X take?), see example2
  • decorating a method (think OOP), see example3
  • another method decorator, but using a Func type, useful when the func signature is rather long, see example4
  • method decorator that takes arguments example5
  • return the result from the decorated function, instead of printing it example6
  • a logging decorator, see example7
  • a nested decorator example, see example8
  • passing data to a http handler is a little weird (to me), but a fully working example is here: go-web-random
  • let's play with a interface example9

contribute

pull requests are welcomed

FAQs

Package last updated on 31 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc