diff options
author | Daniel Langesten <daniel.langest@gmail.com> | 2015-03-10 14:28:37 +0100 |
---|---|---|
committer | Daniel Langesten <daniel.langest@gmail.com> | 2015-03-10 14:28:37 +0100 |
commit | 40b81c6cbf5b427fda223aade06c1e933547a91f (patch) | |
tree | e5047983404d6c9be4d47d3d5f36a3b50ddd1524 | |
parent | 97bdf75c9bcbd4f2519fe8a1be2925ddd3792f70 (diff) |
finished configuration parsing
-rw-r--r-- | config.go | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -2,8 +2,8 @@ package main import ( "encoding/json" - "fmt" "io/ioutil" + "log" ) type Config struct { @@ -17,20 +17,14 @@ type VolumeInfo struct { Upper int `json:upper` } -func main() { - readConfig() -} - -func readConfig() { +func readConfig() (conf Config, err error) { content, err := ioutil.ReadFile("config.json") if err != nil { - fmt.Print("Error:", err) + log.Println(err) } - var conf Config err = json.Unmarshal(content, &conf) if err != nil { - fmt.Print("Error:", err) + log.Println(err) } - fmt.Println(conf) - + return } |