mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -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 {
|
||||
fsTypeHex := strconv.FormatInt(ftype, 16)
|
||||
fsTypeString, ok := fsType2StringMap[fsTypeHex]
|
||||
if ok == false {
|
||||
if !ok {
|
||||
return "UNKNOWN"
|
||||
}
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -276,14 +276,9 @@ func (c AdminClient) dumpHTTP(req *http.Request, resp *http.Response) error {
|
||||
|
||||
// Ends the http dump.
|
||||
_, err = fmt.Fprintln(c.traceOutput, "---------END-HTTP---------")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Returns success.
|
||||
return nil
|
||||
}
|
||||
|
||||
// do - execute http request.
|
||||
func (c AdminClient) do(req *http.Request) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
|
@ -211,11 +211,8 @@ func (adm *AdminClient) listObjectsHeal(bucket, prefix, marker, delimiter string
|
||||
}
|
||||
|
||||
err = xml.NewDecoder(resp.Body).Decode(&toBeHealedObjects)
|
||||
if err != nil {
|
||||
return toBeHealedObjects, err
|
||||
}
|
||||
return toBeHealedObjects, nil
|
||||
}
|
||||
|
||||
// ListObjectsHeal - Lists upto maxKeys objects that needing heal matching bucket, prefix, marker, delimiter.
|
||||
func (adm *AdminClient) ListObjectsHeal(bucket, prefix string, recursive bool, doneCh <-chan struct{}) (<-chan ObjectInfo, error) {
|
||||
|
@ -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");
|
||||
* 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)
|
||||
}
|
||||
compressible := DB["txt"].Compressible
|
||||
if compressible != false {
|
||||
if 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
|
||||
// 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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user