Skip to content

Commit

Permalink
doc(go/patterns): up note
Browse files Browse the repository at this point in the history
  • Loading branch information
TIGERB committed Jan 14, 2020
1 parent 5b99cf8 commit fcd5eb7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions go/src/patterns/factory/factory-abstact.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//抽象工厂模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

import "fmt"

Expand Down
4 changes: 2 additions & 2 deletions go/src/patterns/factory/factory-easy.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//简单工厂模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

import "fmt"

Expand Down
4 changes: 2 additions & 2 deletions go/src/patterns/factory/factory.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//工厂模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

import "fmt"

Expand Down
10 changes: 4 additions & 6 deletions go/src/patterns/observer/observer.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//观察者模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

import "fmt"

Expand Down Expand Up @@ -127,8 +127,7 @@ func (Observable *ObservableOrderCreate) Notify() error {
func main() {
// 具体使用
(&ObservableOrderCreate{}).Init(&Request{}).
// 观察者观察被观察者
Attach(
Attach( // 观察者观察被观察者
&Param{},
&Address{},
&Check{},
Expand All @@ -137,6 +136,5 @@ func main() {
&Address{},
&Log{},
).
// 被观察者通知观察者
Notify()
Notify() // 被观察者通知观察者
}
4 changes: 2 additions & 2 deletions go/src/patterns/singleton/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"sync"
)

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//单例模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

// // ---------线程不安全的单例 ---------
// var instance *singleton
Expand Down
4 changes: 2 additions & 2 deletions go/src/patterns/strategy/strategy.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//策略模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

import "fmt"

Expand Down
6 changes: 4 additions & 2 deletions go/src/patterns/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"runtime"
)

//---------------
//------------------------------------------------------------
//叼叼的设计模式(Go享版)
//模板模式
//@auhtor TIGERB<https://github.com/TIGERB>
//---------------
//------------------------------------------------------------

// Context 上下文
type Context struct {
Expand Down Expand Up @@ -86,6 +86,8 @@ type Lottery struct {

// Run 抽奖算法
func (lottery *Lottery) Run(ctx *Context) (err error) {
// 参数校验
// 获取活动信息
if err := lottery.ConcreteBehavior.Check(ctx); err != nil {
return err
}
Expand Down

0 comments on commit fcd5eb7

Please sign in to comment.