diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-10-22 22:55:43 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-10-22 22:56:11 +0300 |
commit | 72c9dac62cb6282841d22d877852bcee26bff9dd (patch) | |
tree | 772c3bc19f4461f6ffd427a61476c53b8b75158d /config/config.go | |
parent | 9b4a09677a352d9938e4505bfc2d0c8d304567ac (diff) |
Add tests for config package (failing for now)
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/config/config.go b/config/config.go index be05cb5..2ec6706 100644 --- a/config/config.go +++ b/config/config.go @@ -1,8 +1,8 @@ package config import ( + "github.com/pkg/errors" "io/ioutil" - "log" "gopkg.in/yaml.v2" ) @@ -47,18 +47,18 @@ type TelegramTdlibClientConfig struct { UseChatInfoDatabase bool `yaml:":use_chat_info_database"` } -func ReadConfig(path string) Config { +func ReadConfig(path string) (Config, error) { var config Config file, err := ioutil.ReadFile(path) if err != nil { - log.Fatalf("Can't open config file: %v", err) + return config, errors.Wrap(err, "Can't open config file") } err = yaml.Unmarshal(file, &config) if err != nil { - log.Fatalf("Error parsing config: %v", err) + return config, errors.Wrap(err, "Error parsing config") } - return config + return config, nil } |