From 156a437f678221bb66e211f964d498ade378cee9 Mon Sep 17 00:00:00 2001 From: biwentao Date: Tue, 27 Sep 2022 19:20:19 +0800 Subject: [PATCH] fix: wrap --- 20_decorator/decorator.go | 4 ++-- 20_decorator/decorator_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/20_decorator/decorator.go b/20_decorator/decorator.go index 829eeaa..26fe69d 100644 --- a/20_decorator/decorator.go +++ b/20_decorator/decorator.go @@ -15,7 +15,7 @@ type MulDecorator struct { num int } -func WarpMulDecorator(c Component, num int) Component { +func WrapMulDecorator(c Component, num int) Component { return &MulDecorator{ Component: c, num: num, @@ -31,7 +31,7 @@ type AddDecorator struct { num int } -func WarpAddDecorator(c Component, num int) Component { +func WrapAddDecorator(c Component, num int) Component { return &AddDecorator{ Component: c, num: num, diff --git a/20_decorator/decorator_test.go b/20_decorator/decorator_test.go index bf46b22..fa4f665 100644 --- a/20_decorator/decorator_test.go +++ b/20_decorator/decorator_test.go @@ -4,8 +4,8 @@ import "fmt" func ExampleDecorator() { var c Component = &ConcreteComponent{} - c = WarpAddDecorator(c, 10) - c = WarpMulDecorator(c, 8) + c = WrapAddDecorator(c, 10) + c = WrapMulDecorator(c, 8) res := c.Calc() fmt.Printf("res %d\n", res)