package main import ( "os" "gopkg.in/yaml.v2" ) type Config struct { Gitea struct { InstanceURL string `yaml:"instance_url"` Owner string `yaml:"owner"` Repository string `yaml:"repository"` } `yaml:"gitea"` Language struct { OpeningOnSeparateLine bool `yaml:"separate_opening"` Opening string `yaml:"opening"` Continuation string `yaml:"continuation"` Closing string `yaml:"closing"` } `yaml:"language"` } func LoadConfig(config *Config, filename string) { if filename == "" { filename = ".frag_review.yml" } configFile, err := os.Open(filename) ExitOnError(err) defer configFile.Close() decoder := yaml.NewDecoder(configFile) err = decoder.Decode(&config) ExitOnError(err) }