fuzzyworld

template / files / internal / core / extras.go

extras.go

424 B · history · blame

1package core
2
3import (
4 "fmt"
5 "os"
6
7 "gopkg.in/yaml.v3"
8)
9
10func loadExtras(path string) (map[string]string, error) {
11 emptyMap := make(map[string]string)
12
13 file, err := os.ReadFile(path)
14 if err != nil {
15 return emptyMap, fmt.Errorf("error reading extras file %v: %v", path, err)
16 }
17
18 result := make(map[string]string)
19 err = yaml.Unmarshal(file, &result)
20 if err != nil {
21 return emptyMap, err
22 }
23
24 return result, nil
25}