package cvdata import ( "fmt" utils "github.com/jesusperez/datautils" ) type OtherType struct { Auth AuthInfoType `yaml:"auth" json:"auth"` Desc string `yaml:"desc" json:"desc"` } type Others struct { Others []OtherType `yaml:"others" json:"others"` } func (others *Others)Load(path string) ([]OtherType, error) { d,file,errpath := utils.DecoderFromFile(path) if errpath != nil { return others.Others, errpath } defer file.Close() if err := d.Decode(&others); err != nil { fmt.Printf("Decode: %v", err) return others.Others, err } return others.Others, nil }