mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
cleanup: All conditionals simplified under pkg. (#3875)
Address all the changes reported/recommended by `gosimple` tool.
This commit is contained in:
parent
43317530d5
commit
85cbd875fc
@ -40,7 +40,7 @@ var fsType2StringMap = map[string]string{
|
|||||||
func getFSType(ftype int64) string {
|
func getFSType(ftype int64) string {
|
||||||
fsTypeHex := strconv.FormatInt(ftype, 16)
|
fsTypeHex := strconv.FormatInt(ftype, 16)
|
||||||
fsTypeString, ok := fsType2StringMap[fsTypeHex]
|
fsTypeString, ok := fsType2StringMap[fsTypeHex]
|
||||||
if ok == false {
|
if !ok {
|
||||||
return "UNKNOWN"
|
return "UNKNOWN"
|
||||||
}
|
}
|
||||||
return fsTypeString
|
return fsTypeString
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Minio Cloud Storage, (C) 2016 Minio, Inc.
|
* Minio Cloud Storage, (C) 2016, 2017 Minio, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -276,12 +276,7 @@ func (c AdminClient) dumpHTTP(req *http.Request, resp *http.Response) error {
|
|||||||
|
|
||||||
// Ends the http dump.
|
// Ends the http dump.
|
||||||
_, err = fmt.Fprintln(c.traceOutput, "---------END-HTTP---------")
|
_, err = fmt.Fprintln(c.traceOutput, "---------END-HTTP---------")
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns success.
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// do - execute http request.
|
// do - execute http request.
|
||||||
|
@ -211,10 +211,7 @@ func (adm *AdminClient) listObjectsHeal(bucket, prefix, marker, delimiter string
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = xml.NewDecoder(resp.Body).Decode(&toBeHealedObjects)
|
err = xml.NewDecoder(resp.Body).Decode(&toBeHealedObjects)
|
||||||
if err != nil {
|
return toBeHealedObjects, err
|
||||||
return toBeHealedObjects, err
|
|
||||||
}
|
|
||||||
return toBeHealedObjects, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListObjectsHeal - Lists upto maxKeys objects that needing heal matching bucket, prefix, marker, delimiter.
|
// ListObjectsHeal - Lists upto maxKeys objects that needing heal matching bucket, prefix, marker, delimiter.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* mime-db: Mime Database, (C) 2015, 2016 Minio, Inc.
|
* mime-db: Mime Database, (C) 2015, 2016, 2017 Minio, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -25,7 +25,7 @@ func TestMimeLookup(t *testing.T) {
|
|||||||
t.Fatalf("Invalid content type are found expected \"application/x-msdownload\", got %s", contentType)
|
t.Fatalf("Invalid content type are found expected \"application/x-msdownload\", got %s", contentType)
|
||||||
}
|
}
|
||||||
compressible := DB["txt"].Compressible
|
compressible := DB["txt"].Compressible
|
||||||
if compressible != false {
|
if compressible {
|
||||||
t.Fatalf("Invalid content type are found expected \"false\", got %t", compressible)
|
t.Fatalf("Invalid content type are found expected \"false\", got %t", compressible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,7 @@ func saveFileConfig(filename string, v interface{}) error {
|
|||||||
// decoder format according to the filename extension. If no
|
// decoder format according to the filename extension. If no
|
||||||
// extension is provided, json will be selected by default.
|
// extension is provided, json will be selected by default.
|
||||||
func loadFileConfig(filename string, v interface{}) error {
|
func loadFileConfig(filename string, v interface{}) error {
|
||||||
_, err := os.Stat(filename)
|
if _, err := os.Stat(filename); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fileData, err := ioutil.ReadFile(filename)
|
fileData, err := ioutil.ReadFile(filename)
|
||||||
@ -133,10 +132,6 @@ func loadFileConfig(filename string, v interface{}) error {
|
|||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
|
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
|
||||||
}
|
}
|
||||||
ext := filepath.Ext(filename)
|
|
||||||
// Unmarshal file's content
|
// Unmarshal file's content
|
||||||
if err := toUnmarshaller(ext)(fileData, v); err != nil {
|
return toUnmarshaller(filepath.Ext(filename))(fileData, v)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user