package qver type Option func(*options) type options struct { parent *Version UpdateFunc state interface{} } func parse(opts ...Option) options { var o options for _, opt := range opts { opt(&o) } return o } // Whenever the version changes, bump the parent's version as well. func Parent(p *Version) Option { return func(o *options) { o.parent = p } } // Call f(state) to update the version whenever Version.Get() is called. func Update(state interface{}, f UpdateFunc) Option { return func(o *options) { o.UpdateFunc = f o.state = state } }