Learning Functional Programming in Go
上QQ阅读APP看书,第一时间看更新

A decorator implementation

Our decorator pattern example will be runnable, so we'll put it in the main package and define a main() function.

We use the easy-metrics package for recording and displaying our metrics. It comes out of the box with a nice GUI for displaying statistics.

We also import the decorator package and preface that import with a dot (.) in order to access the identifiers in the decorator package, in the local file block without a qualifier.