package main import ( "gopkg.in/yaml.v2" "os" "path" ) type Config struct { Remote string `yaml:"remote"` } func loadConfig() (*Config, error) { homedir, err := os.UserHomeDir() if err != nil { return nil, err } f, err := os.Open(path.Join(homedir, ".config/lucy.yaml")) if err != nil { return nil, err } cfg := Config{} err = yaml.NewDecoder(f).Decode(&cfg) if err != nil { return nil, err } return &cfg, nil }