mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
cleanup: All conditionals simplified under pkg. (#3875)
Address all the changes reported/recommended by `gosimple` tool.
This commit is contained in:
@@ -122,8 +122,7 @@ func saveFileConfig(filename string, v interface{}) error {
|
||||
// decoder format according to the filename extension. If no
|
||||
// extension is provided, json will be selected by default.
|
||||
func loadFileConfig(filename string, v interface{}) error {
|
||||
_, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
if _, err := os.Stat(filename); err != nil {
|
||||
return err
|
||||
}
|
||||
fileData, err := ioutil.ReadFile(filename)
|
||||
@@ -133,10 +132,6 @@ func loadFileConfig(filename string, v interface{}) error {
|
||||
if runtime.GOOS == "windows" {
|
||||
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
|
||||
}
|
||||
ext := filepath.Ext(filename)
|
||||
// Unmarshal file's content
|
||||
if err := toUnmarshaller(ext)(fileData, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return toUnmarshaller(filepath.Ext(filename))(fileData, v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user