type Optional struct { stuff interface{} present bool } func (o Optional) Get() (interface{}, bool) { return o.stuff, o.present } func NewOptional(stuff interface{}) { return Optional(stuff, true) }