aboutsummaryrefslogtreecommitdiff
path: root/pkg/config/config.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 17:05:07 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 17:05:07 +0200
commitf944124325dd785085fec59210306111b3eab3b7 (patch)
tree53f88d24f42093df907f68a1a7eaf942bed0aeee /pkg/config/config.go
parentd7de88398ca67d7213fb849db60e5963fd3bc32f (diff)
downloadfeed2imap-go-f944124325dd785085fec59210306111b3eab3b7.tar.gz
feed2imap-go-f944124325dd785085fec59210306111b3eab3b7.tar.bz2
feed2imap-go-f944124325dd785085fec59210306111b3eab3b7.zip
Yaml: Pass `Reader` around instead of []byte
Diffstat (limited to '')
-rw-r--r--pkg/config/config.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index de8e4ad..6d51ffc 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -2,7 +2,6 @@ package config
import (
"fmt"
- "io/ioutil"
"os"
"os/user"
"runtime"
@@ -102,13 +101,13 @@ func Version() string {
func Load(path string) (*Config, error) {
log.Printf("Reading configuration file '%s'", path)
- buf, err := ioutil.ReadFile(path)
+ f, err := os.Open(path)
if err != nil {
- return nil, fmt.Errorf("while reading '%s': %w", path, err)
+ return nil, fmt.Errorf("while opening '%s': %w", path, err)
}
cfg := WithDefault()
- if err = cfg.parse(buf); err != nil {
+ if err = cfg.parse(f); err != nil {
return nil, fmt.Errorf("while parsing: %w", err)
}