This commit is contained in:
crusader 2017-11-09 15:26:30 +09:00
parent dcd0b68205
commit 40c5c34b12

View File

@ -2,6 +2,7 @@ package config
import ( import (
"bytes" "bytes"
"fmt"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
@ -65,6 +66,10 @@ func Load(target interface{}, files ...string) error {
func (c *config) Load(target interface{}, files ...string) error { func (c *config) Load(target interface{}, files ...string) error {
filenames := c.getConfigFiles(files...) filenames := c.getConfigFiles(files...)
if 0 == len(filenames) {
return fmt.Errorf("Config: have no config files in [%v]", files)
}
for _, file := range filenames { for _, file := range filenames {
if err := unmarshalFile(target, file); err != nil { if err := unmarshalFile(target, file); err != nil {
return err return err