package models type Drivers map[string]*Driver type Driver struct { Type string `json:"type,omitempty"` Bus string `json:"bus"` Address uint `json:"address"` } func NewDrivers() Drivers { return make(Drivers) } func (d *Drivers) AddDriver(typ, bus string, address uint) { (*d)[typ] = &Driver{ Bus: bus, Address: address, } }