No need for ConfigLoader interface

This commit is contained in:
Marcin Kulik
2014-11-12 20:58:14 +01:00
parent 1f2efcb10b
commit b872658550
2 changed files with 2 additions and 10 deletions

View File

@@ -11,9 +11,7 @@ import (
)
func main() {
cl := &util.FileConfigLoader{}
cfg, err := cl.LoadConfig()
cfg, err := util.LoadConfig()
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@@ -25,13 +25,7 @@ type Config struct {
}
}
type ConfigLoader interface {
LoadConfig() (*Config, error)
}
type FileConfigLoader struct{}
func (l *FileConfigLoader) LoadConfig() (*Config, error) {
func LoadConfig() (*Config, error) {
homeDir := os.Getenv("HOME")
if homeDir == "" {
return nil, errors.New("Need $HOME")