- golang option pattern
- option struct
```
type option struct {
Name string
Age int
}
```
- option func type
```
type Option func(*options)
func F1(name string) Option{
return fun(op *option){
op.Name = name
}
}
}
func F2(age int) Option{
return func(op *option) {
op.Age= age
}
}
```
- usage
```
func NewOption(setters ...Option){
op := &option{}
for s:=range setters{
s(op)
}
return op
}
NewOption(F1("tom"),F2(18))
```