package config type Alarm struct { Name string `yaml:"name"` Type string `yaml:"type"` Attrs map[string]interface{} `yaml:",inline"` } func (alm Alarm) NameOrType() string { if alm.Name == "" { return alm.Type } return alm.Name }