Introduce staticcheck for stricter builds (#7035)

This commit is contained in:
Harshavardhana
2019-02-13 04:59:36 -08:00
committed by Nitish Tiwari
parent 4ba77a916d
commit df35d7db9d
71 changed files with 274 additions and 777 deletions

View File

@@ -228,11 +228,7 @@ func getProfileData() ([]byte, error) {
}
// Starts a profiler returns nil if profiler is not enabled, caller needs to handle this.
func startProfiler(profilerType, dirPath string) (interface {
Stop()
Path() string
}, error) {
func startProfiler(profilerType, dirPath string) (minioProfiler, error) {
var err error
if dirPath == "" {
dirPath, err = ioutil.TempDir("", "profile")
@@ -277,14 +273,17 @@ func startProfiler(profilerType, dirPath string) (interface {
}, nil
}
// Global profiler to be used by service go-routine.
var globalProfiler interface {
// minioProfiler - minio profiler interface.
type minioProfiler interface {
// Stop the profiler
Stop()
// Return the path of the profiling file
Path() string
}
// Global profiler to be used by service go-routine.
var globalProfiler minioProfiler
// dump the request into a string in JSON format.
func dumpRequest(r *http.Request) string {
header := cloneHeader(r.Header)
@@ -307,7 +306,7 @@ func dumpRequest(r *http.Request) string {
}
// Formatted string.
return strings.TrimSpace(string(buffer.Bytes()))
return strings.TrimSpace(buffer.String())
}
// isFile - returns whether given path is a file or not.