package gelfexporter type config struct { GelfUrl string AppName string } // newConfig creates a validated Config configured with options. func newConfig(options ...Option) (config, error) { cfg := config{} for _, opt := range options { cfg = opt.apply(cfg) } return cfg, nil } // Option sets the value of an option for a Config. type Option interface { apply(config) config } func WithGelfUrl(url string) Option { return gelfUrlOption(url) } type gelfUrlOption string func (o gelfUrlOption) apply(cfg config) config { cfg.GelfUrl = string(o) return cfg } func WithAppName(url string) Option { return appName(url) } type appName string func (o appName) apply(cfg config) config { cfg.AppName = string(o) return cfg }