diff options
author | Teddy Wing | 2017-03-11 14:33:08 +0100 |
---|---|---|
committer | Teddy Wing | 2017-03-11 14:33:08 +0100 |
commit | e6eee887588efff57d7e8b39894143880357f61c (patch) | |
tree | 812c7095cecc7a3bb3bf463d84b1bf51026fcb54 /main.go | |
parent | 7010ef25c90272b81eff2f37a3ca7ac5afd53b69 (diff) | |
download | timetasker-e6eee887588efff57d7e8b39894143880357f61c.tar.bz2 |
main.go: Move config loading to a new function
* Extract the config loading lines from `main` so we can give them a name
* Make `config` available globally
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -37,13 +37,17 @@ type Config struct { } } +var config Config + func main() { + loadConfig() +} + +func loadConfig() { config_str, err := ioutil.ReadFile("config.yml") - config := Config{} + config = Config{} err = yaml.Unmarshal(config_str, &config) if err != nil { log.Println(err) } - - log.Printf("%+v", config) } |