1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| configFile, err := os.Open(f) if err != nil { return err } fi, _ := configFile.Stat() if fi.Size() == 0 { return fmt.Errorf("config file (%s) is empty", f.dictionaryPath) } buffer := make([]byte, fi.Size()) if _, err := configFile.Read(buffer); err != nil { return err } dict := make(map[interface{}]interface{}) if err := yaml.Unmarshal(buffer, &dict); err != nil { return err }
|