package authn type Options struct { TemplateDir string Debug bool } type OptionFunc func(*Options) func NewOptions(funcs ...OptionFunc) *Options { opts := &Options{ TemplateDir: "./templates", Debug: false, } for _, fn := range funcs { fn(opts) } return opts } func WithTemplateDir(templateDir string) OptionFunc { return func(o *Options) { o.TemplateDir = templateDir } } func WithDebug(debug bool) OptionFunc { return func(o *Options) { o.Debug = debug } }